SDL 1.3: OpenGL flickering


I have converted my game from D3D to OpenGL, and it all seems to work, except I get flickering on a window
where stuff changes often (I don’t redraw every frame, I use a dirty rects method…ish).

I initialise my windows with SDL_RENDERER_SINGLEBUFFER, but I assume OGL uses double buffering? It appears
as if it’s swapping buffers but the 2nd/back buffer has old data in. Every 2nd update, as it were, the back buffer
is updated.

My guess is the flickering is caused by something fairly simple.

This is on quite an old version (late 2010) of SDL 1.3 - pre the big render update.


Hi,On 5/6/11 6:12 PM, ebyard wrote:

I initialise my windows with SDL_RENDERER_SINGLEBUFFER
Don’t do that :slight_smile:


Don’t do that :slight_smile:

I’ve tried various permutations of flags. If I do as you say and remove that flag, then both windows flicker (forgot to mention, only 1 does it).

My guess is OpenGL is double-buffering by default. But also interesting is that SDL_GetError returns “Invalid texture” when SDL_RenderCopy
is called. So something else is going on, maybe.

I can see GL_SwapWindow is being called, but I don’t know enough about SDL+OpenGL to understand what is going on, hence the forum post.


I think it’s solved…I was using SDL_WINDOW_OPENGL when creating the window, and I’m not using any OpenGL contexts.

So, erm…it works. It seems to be calling all the SDL_GL functions so I assume it’s using the OpenGL renderer.
This is all a bit voodoo to me.

But it works, so great :slight_smile: