nanogui
nanogui copied to clipboard
Example 3 - Graphics flickering
Hi,
I have found in my own project, and reproduced in the example 3 executable some odd screen flickering.
If you run up example3 and drag the "Form helper example" window its starts to flicker about.
I think this is due to glfwSwapBuffers being called twice in succession.
Here is the current loop in example3.cpp:
// Game loop
while (!glfwWindowShouldClose(window)) {
// Check if any events have been activated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
// Draw nanogui
screen->draw_setup();
screen->clear(); // glClear
screen->draw_contents();
screen->draw_widgets();
screen->draw_teardown();
glfwSwapBuffers(window);
}
The line screen->draw_teardown() also calls glfwSwapBuffers.
Removing this line seems to fix the issue - but I am still naive with nanogui so not sure if this fix is truely "correct"!
I have the same problem and I removed/commented glfwSwapBuffers(window);