SDL Error: Could not retrieve OpenGL functions

Hello,

since I downloaded and installed the latest SDL development
version 1.1.1 for Linux, I can no longer use it for creating an
OpenGL context. I get the error message:

SDL Error: Could not retrieve OpenGL functions

The problem seems to be, that I use SDL from another dynamic library.
I must do this, because I need it below a given plugin interface for
input and sound.

A quick look into the sources shows that SDL_x11gl.c uses dlopen with a NULL
argument, which means the handle for the main program.

Indeed it works, if I link the main program with the GL libraries.

This, of course, breaks the intention of the plugin interface.

Is there a special reason for this behaviour?

  • Markus

In article <20000312175556.D7DC176.NOFFLE at gorkon.dialin.t-online.de>, markus.enzenberger at t-online.de (Markus Enzenberger) wrote:

since I downloaded and installed the latest SDL development
version 1.1.1 for Linux, I can no longer use it for creating an
OpenGL context. I get the error message:

SDL Error: Could not retrieve OpenGL functions

The problem seems to be, that I use SDL from another dynamic library.
I must do this, because I need it below a given plugin interface for
input and sound.

A quick look into the sources shows that SDL_x11gl.c uses dlopen with a NULL
argument, which means the handle for the main program.

Indeed it works, if I link the main program with the GL libraries.

I’ve come across this myself, trying to code an xmms plugin using sdl to handel the
opengl context creation. I fixed it for me by adding a dummy dlopen to my code:

dlopen("libGL.so", RTLD_LAZY | RTLD_GLOBAL);

After that SDL_SetVideoMode succeeds. I know it’s an ugly hack but it works - the old
sdl cvs tree did the same, basically.

You can also fix it by setting LD_PRELOAD to libGL.so. This way you don’t have to
recompile the main program, but SDL will still be able to resolv the glx symbols globally.

cheers,--------------------------------------------------------------
Christian Zander ** N?ckersberg 76 ** 45257 Essen ** Germany
email: mbox at minion.de ** www: www.minion.de ** icq#: 5322926

Hello,

since I downloaded and installed the latest SDL development
version 1.1.1 for Linux, I can no longer use it for creating an
OpenGL context. I get the error message:

SDL Error: Could not retrieve OpenGL functions

The problem seems to be, that I use SDL from another dynamic library.
I must do this, because I need it below a given plugin interface for
input and sound.

This should be fixed in the latest CVS snapshot.
Please let me know if it isn’t.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

opengl context creation. I fixed it for me by adding a dummy dlopen to my code:

dlopen(“libGL.so”, RTLD_LAZY | RTLD_GLOBAL);

After that SDL_SetVideoMode succeeds. I know it’s an ugly hack but it works - the old
sdl cvs tree did the same, basically.

Thanks for the workaround. It works for me, but I even need to do a
dlopen(“libXext”) before, otherwise dlopen(“libGL.so”) returns 0.

I still do not understand, why SDL uses dlopen(NULL).

  • MarkusOn Sun, 12 Mar 2000 19:53:30 +0100, phoenix at minion.de wrote:

Markus Enzenberger wrote:

I still do not understand, why SDL uses dlopen(NULL).

It is possible that the app statically links against a special version
of libGL. And this way SDL will use the version (the symbols) the app
provides (if the app exports them).–
Daniel Vogel My opinions may have changed,
666 @ http://grafzahl.de but not the fact that I am right

opengl context creation. I fixed it for me by adding a dummy dlopen to my code:

dlopen(“libGL.so”, RTLD_LAZY | RTLD_GLOBAL);

After that SDL_SetVideoMode succeeds. I know it’s an ugly hack but it works - the old
sdl cvs tree did the same, basically.

Thanks for the workaround. It works for me, but I even need to do a
dlopen(“libXext”) before, otherwise dlopen(“libGL.so”) returns 0.

I still do not understand, why SDL uses dlopen(NULL).

Try the latest CVS snapshot - it should work fine without the workaround.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software> On Sun, 12 Mar 2000 19:53:30 +0100, phoenix at minion.de wrote:

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec