Is there any interest in being able to automatically link the shared
gl library at runtime? It makes the projects simpler (no gl
function pointers and such) and all of the target platforms have
opengl support libraries.
Well, I used to do that before, and I have GNU Autoconf scripts to
take care of the details of linking - statically or dynamically -
However, the problem is that dynamic linking means the application
won’t even load if there’s no OpenGL lib. (That’s why there are two
binaries in current (old) Kobo Deluxe Win32 packages; the one with
OpenGL support won’t even load without an opengl32.dll.)
Static linking is pretty much out, unless you count on all users
building from source, as some (most?) platforms have driver specific
So, I’d recommend the third kind of “linking”; load it manually.
Otherwise, is there already an encapsulation of OpenGL around
somewhere which works with SDL and implements auto-detection/loading
of the library and auto-linking stubs to the gl functions, or is
that something else I’m gonna have to write?
There are various OpenGL helpers around, but I don’t have much
experience with them… Just grabbing the functions isn’t that much
work anyway. Grabbing only the ones you actually use could be nice if
you’re using functions that may not be provided by all drivers - but
then again, a helper library could just wire the stubs to some
function that grabs the real function if/when it’s hit the first
As it seems to me now, I’d still have the problem of needing to
figure out the correct path of the gl library on each system, just
the problem moves to runtime instead of compile-time.
Is there some portable way to detect these?
SDL does that. Unless you want to load a specific, nonstandard OpenGL
driver, just pass NULL to SDL_GL_LoadLibrary(), and it’ll load the
standard library on whatever platform you’re on.
This seems to be undocumented, though… “It Works Here™” IIRC,
I actually found out about this feature while messing with the glSDL
backend, and converting glSDL/wrapper to run time OpenGL loading. I
think I found default library paths for all platforms with OpenGL
support, but I’m not 100% sure…
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Thursday 31 March 2005 20.35, Steaphan Greene wrote: