[SDL] sdl-config
skaller
skaller at users.sourceforge.net
Tue Feb 28 01:27:33 PST 2006
On Tue, 2006-02-28 at 02:06 -0500, Simon Roby wrote:
> On 2/24/06, skaller <skaller at users.sourceforge.net> wrote:
> > Hi, I am having a problem statically linking SDL with openGL support,
> > and wonder if someone can throw some light on this.
>
> Well first of all AFAIK one should _never_ statically link OpenGL to
> anything. libGL.so (or opengl32.dll, or whatever it's called) is
> implementation-specific.
That may be so, but my system supports static linkage in general,
and will support static linkage to GL libraries if they're available
as static archives. Whether that's a good thing to do or not is up
to Felix client programmers not Felix developers: if I can give
them a reasonable choice I'd like to.
> That's normal. SDL does not link to libGL.
[]
> > Stuff runs, if one adds -lGL -lGLU to dynamic link.
> > Is something misconfigured, or do I misunderstand something?
>
> It's not a bug, it's a feature ;) It is not included in sdl-config
> because linking libGL to every SDL application would add an unneeded
> dependency, since not every SDL app would need one.
OK. Thanks for your detailed explanation! I think this answers
the question plainly.
> The best way to handle OpenGL in a fully portable manner is to do
> run-time dynamic loading, which requires no compile-time linking to
> libGL whatsoever. Luckily SDL is great for that.
>
> First off call SDL_GL_LoadLibrary(NULL) to load the GL library. You
> can substitute NULL for a string containing the full path to a GL
> library, but leaving it to NULL indicates SDL to find the default one
> on the system, which usually works out perfectly.
Ah, ok. I wasn't aware of that function -- well, I saw it but didn't
know what it was for because I didn't really understand the structure
of Open GL and friends. Your explanation here is very good --
thanks!
> There are also free libraries available to do the ugly symbol loading
> stuff mentionned above, but I've never used one myself so I can't give
> my opinion on any of them. The most popular of them appears to be the
> one called "glew".
I've had a brief look at glew. It's an extra dependency,
but again, use or not of it should be up to the client
programmer not me. However the header files looked particularly
difficult to understand. (I have to build a binding to it,
since Felix isn't C: I have a tool which can do that automatically
but it can't handle macros since macro variables and
functions don't have any obvious type)
Anyhow, thanks again for taking the time to give this
explanation, and I hope someone else benefits from it.
May even be worth placing in the FAQ?
--
John Skaller <skaller at users dot sourceforge dot net>
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net
More information about the SDL
mailing list