Enable text overlay
This commit is contained in:
parent
0b972e51a4
commit
33dfa8cac9
1 changed files with 13 additions and 27 deletions
|
|
@ -83,8 +83,8 @@ public:
|
||||||
zoom = -15.0f;
|
zoom = -15.0f;
|
||||||
rotationSpeed = 0.25f;
|
rotationSpeed = 0.25f;
|
||||||
rotation = { -15.0f, 35.0f, 0.0f };
|
rotation = { -15.0f, 35.0f, 0.0f };
|
||||||
|
enableTextOverlay = true;
|
||||||
title = "Vulkan Example - Texture arrays";
|
title = "Vulkan Example - Texture arrays";
|
||||||
srand(time(NULL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~VulkanExample()
|
~VulkanExample()
|
||||||
|
|
@ -336,8 +336,6 @@ public:
|
||||||
renderPassBeginInfo.clearValueCount = 2;
|
renderPassBeginInfo.clearValueCount = 2;
|
||||||
renderPassBeginInfo.pClearValues = clearValues;
|
renderPassBeginInfo.pClearValues = clearValues;
|
||||||
|
|
||||||
VkResult err;
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < drawCmdBuffers.size(); ++i)
|
for (int32_t i = 0; i < drawCmdBuffers.size(); ++i)
|
||||||
{
|
{
|
||||||
// Set target frame buffer
|
// Set target frame buffer
|
||||||
|
|
@ -368,27 +366,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw()
|
|
||||||
{
|
|
||||||
// Get next image in the swap chain (back/front buffer)
|
|
||||||
VK_CHECK_RESULT(swapChain.acquireNextImage(semaphores.presentComplete, ¤tBuffer));
|
|
||||||
|
|
||||||
submitPostPresentBarrier(swapChain.buffers[currentBuffer].image);
|
|
||||||
|
|
||||||
// Command buffer to be sumitted to the queue
|
|
||||||
submitInfo.commandBufferCount = 1;
|
|
||||||
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
|
|
||||||
|
|
||||||
// Submit to queue
|
|
||||||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
|
||||||
|
|
||||||
submitPrePresentBarrier(swapChain.buffers[currentBuffer].image);
|
|
||||||
|
|
||||||
VK_CHECK_RESULT(swapChain.queuePresent(queue, currentBuffer, semaphores.renderComplete));
|
|
||||||
|
|
||||||
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup vertices for a single uv-mapped quad
|
// Setup vertices for a single uv-mapped quad
|
||||||
void generateQuad()
|
void generateQuad()
|
||||||
{
|
{
|
||||||
|
|
@ -620,12 +597,12 @@ public:
|
||||||
{
|
{
|
||||||
uboVS.instance = new UboInstanceData[layerCount];
|
uboVS.instance = new UboInstanceData[layerCount];
|
||||||
|
|
||||||
VkResult err;
|
|
||||||
uint32_t uboSize = sizeof(uboVS.matrices) + (layerCount * sizeof(UboInstanceData));
|
uint32_t uboSize = sizeof(uboVS.matrices) + (layerCount * sizeof(UboInstanceData));
|
||||||
|
|
||||||
// Vertex shader uniform buffer block
|
// Vertex shader uniform buffer block
|
||||||
createBuffer(
|
createBuffer(
|
||||||
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
|
||||||
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
uboSize,
|
uboSize,
|
||||||
&uboVS,
|
&uboVS,
|
||||||
&uniformData.vertexShader.buffer,
|
&uniformData.vertexShader.buffer,
|
||||||
|
|
@ -676,6 +653,17 @@ public:
|
||||||
vkUnmapMemory(device, uniformData.vertexShader.memory);
|
vkUnmapMemory(device, uniformData.vertexShader.memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
VulkanExampleBase::prepareFrame();
|
||||||
|
|
||||||
|
submitInfo.commandBufferCount = 1;
|
||||||
|
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
|
||||||
|
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||||
|
|
||||||
|
VulkanExampleBase::submitFrame();
|
||||||
|
}
|
||||||
|
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
@ -695,9 +683,7 @@ public:
|
||||||
{
|
{
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
vkDeviceWaitIdle(device);
|
|
||||||
draw();
|
draw();
|
||||||
vkDeviceWaitIdle(device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void viewChanged()
|
virtual void viewChanged()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue