Fix occlusion query example visual glitch
In the occlusion query example, uniform buffers containing visibility flags are only updated when the view changes, and visibility information is calculated from occlusion queries coming from the previous frame. This means a quick mouse movement can produce a visual glitch by which the number of visible fragments becomes zero (and this is correctly reflected in the UI overlay) but the color of the model remains unchanged, or vice versa, until the view is changed again with the mouse. To fix this, update uniform buffers before preparing every frame as part of the draw() method.
This commit is contained in:
parent
c02add8e55
commit
afc1663f85
1 changed files with 2 additions and 6 deletions
|
|
@ -273,6 +273,7 @@ public:
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
|
updateUniformBuffers();
|
||||||
VulkanExampleBase::prepareFrame();
|
VulkanExampleBase::prepareFrame();
|
||||||
|
|
||||||
submitInfo.commandBufferCount = 1;
|
submitInfo.commandBufferCount = 1;
|
||||||
|
|
@ -594,11 +595,6 @@ public:
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void viewChanged()
|
|
||||||
{
|
|
||||||
updateUniformBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
{
|
{
|
||||||
if (overlay->header("Occlusion query results")) {
|
if (overlay->header("Occlusion query results")) {
|
||||||
|
|
@ -609,4 +605,4 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VULKAN_EXAMPLE_MAIN()
|
VULKAN_EXAMPLE_MAIN()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue