Using cube map textures in Vulkan
This recipe shows how to implement a feature with Vulkan that was already done using OpenGL in Chapter 3, Getting Started with OpenGL and Vulkan. The VulkanCubeRenderer
class implements a simple cube map renderer used to draw a skybox.
Getting ready
Before proceeding with this recipe, it is recommended to revisit the Vulkan texture and texture sampler creation code from Chapter 3, Getting Started with OpenGL and Vulkan.
How to do it...
As in the previous recipes, we derive our VulkanCubeRenderer
class from RendererBase
. We need a texture sampler and a cube texture. The actual 3D cube geometry is generated using the programmable vertex pulling technique in the vertex shader, as shown in the previous chapters:
class CubeRenderer: public RendererBase { public:   CubeRenderer(VulkanRenderDevice& vkDev,    VulkanImage inDepthTexture, const char* textureFile);   virtual ~CubeRenderer();   ...