[SDL] How to dynamically check for SDL_GL_SWAP_INTERVAL support

Peter Mulholland darkmatter at freeuk.com
Mon Dec 4 10:38:11 PST 2006


Hello Stephen,

Monday, December 4, 2006, 5:47:00 PM, you wrote:

> Hi, I'm wondering how to check (at runtime) if I can use the GL command:

>     SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );

> This only works on SDL > 1.2.10, I think.  The problem is, how do I 
> check this at runtime, since the SDL lib will be dynamically linked?  
> And just because it's available at compile-time doesn't mean it will be
> at run-time (and vice-versa).

The "enum" is just a value that gets compiled into your program. Older
versions of SDL which don't recognise it should just do nothing
(they might generate an error through SDL_GetError()).

If this is a Linux program, the best thing to do is a) explicitly say
you need 1.2.10 or greater, b) if it's a closed source binary app,
distribute your own libSDL.so with your executable.

-- 
Best regards,
 Peter                            mailto:darkmatter at freeuk.com





More information about the SDL mailing list