Skip to content

Why is my rotating cube flickering? #8014

Answered by HappySapeta
HappySapeta asked this question in Q&A
Discussion options

You must be logged in to vote

My update loop was missing vsync implementation.

// Delay rendering for roughly one monitor refresh interval
    SDL_DisplayMode Mode;
    int refreshIntervalMS = (SDL_GetDesktopDisplayMode(
        SDL_GetWindowDisplayIndex(window_), &Mode) == 0 &&
        Mode.refresh_rate != 0) ? round(1000.0 / Mode.refresh_rate) : 16;
    SDL_Delay(refreshIntervalMS);

and these lines at the end should be removed :

SDL_GL_SwapWindow(window_);
glClear(GL_COLOR_BUFFER_BIT);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HappySapeta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant