[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Static Linking Throuble with OpenGL



Hi there.

Ingo Ruhnke wrote:
So does anybody know how I can produce a binary that uses OpenGL that
will work on all x86 Linux systems out there or at least the ones that
have a correct OpenGL setup?
You could do what the Loki games tended to do and open libGL.so
at RUN-TIME.  You do this either with 'dlopen()' or, if you're
using SDL, SDL_GL_LoadLibrary().

This removes any build-time library dependance on OpenGL (you'll
still need good headers of course), either static or dynamic.
But then you have to extract the OpenGL symbols yourself with
dlsym or SDL_GL_GetProcAddress.

What you do not ever want to do is statically link OpenGL!
Each system's OpenGL libs can embed the specific code needed
either to drive that specific system's card (ie. the old
Mesa+Voodoo) or to talk to a driver-neural layer or bootstrap
those drivers directly.  You need a dynamic solution to take
advantage of this.

Regards,
--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
"I am NOT a nut!  I am the keeper of the seven universal truths!"