[SDL] opengl buffer state
Sami Näätänen
sn.ml at bayminer.com
Mon Apr 9 00:39:01 PDT 2007
On Saturday 31 March 2007, Rhythmic Fistman wrote:
> > From: "Ryan C. Gordon" <icculus at icculus.org>
> >
> > > Is there any SDL way of asking for only 1 buffer?
> >
> > SDL_GL_SetAttribute() can be used to select double/single
> > buffering, but in OpenGL, you really don't want to do a dirty
> > rectangle thing...clear the color buffer every frame, redraw the
> > whole scene and swap buffers.
>
> Thanks, SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0) does the trick,
> in the sense that the resulting image is complete. I didn't actually
> want opengl, I just wanted vbl syncing, hence this experiment, which
> was a failure: there's still tearing, and the image suffers the
> positioning bug of the other mail.
>
> Not sure what to do, I don't really want to translate all the sprite
> drawing code to opengl, it's a bit of a pain as there's a stack of
> bit fiddling.
You don't need to change everything. Just blit like you would normally
do, but blit to SDL Surface you created yourself. Then upload that
Surface to texture and draw one textured quad with opengl.
If this is fast enough, why would you need to change to full opengl?
More information about the SDL
mailing list