[SDL] How to dynamically check for SDL_GL_SWAP_INTERVAL support
Christian Walther
cwalther at gmx.ch
Mon Dec 4 10:56:33 PST 2006
Stephen Anthony wrote:
> I know I could just define that variable to whatever SDL
> 1.2.10 uses and just always call the function, but that seems a hacky
> way of doing things.
That's what I do. To even allow compilation of my app with an older SDL,
I do
#if ! SDL_VERSION_ATLEAST(1, 2, 10)
#define SDL_GL_SWAP_CONTROL 16
#endif
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
This is safe because SDL_GL_SetAttribute quietly returns -1 without
doing any harm if you give it an unknown attribute. (It's not explicitly
documented to do that, but it's obvious if you look at the code, and
it's the only sensible thing to do.)
-Christian
More information about the SDL
mailing list