In my project I use SDL2 + OpenGL. There is simple code. Function VPreRender()
is called when I want to clear buffer and start to draw in it. After that, when I want to show this buffer on the screen, I use functions VPostRender()
.
When the program is started with integrated video card (HD Intel), the window does not blink when it appears. But when I start the program with High-performanced NVIDIA video card, it starts blinking for some seconds and then stops. Then it all looks fine. The same situation appears if I want to resize the window. So what I do wrong? Why is the window blinking?
bool SDLRender::VPreRender()
{
glClearColor(m_backgroundColor.r, m_backgroundColor.g, m_backgroundColor.b, m_backgroundColor.a);
glClear ( GL_COLOR_BUFFER_BIT );
}
bool SDLRender::VPostRender()
{
SDL_GL_SwapWindow(m_pWindow);
}
SDL_GL_SwapWindow()
? This is just a wild guess, but you could get these types of symptoms if you swap multiple times per frame. – Reto Koradi