nanogui icon indicating copy to clipboard operation
nanogui copied to clipboard

Example 3 - Graphics flickering

Open mjrapson opened this issue 4 years ago • 1 comments

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"!

mjrapson avatar Mar 24 '21 09:03 mjrapson

I have the same problem and I removed/commented glfwSwapBuffers(window);

piotrkundu avatar Feb 04 '22 14:02 piotrkundu