Crash with SDL overlay and opengl under x11 + patch

Hi,

I am trying to get overlays working together with openGL on SDL on x11
(I’m using SDL from cvs).

To test this, I modified SDL12/test/testoverlay.c to add the SDL_OPENGL
flag to SDL_SetVideoMode. I also added correct SDL_GL_SetAttribute
calls, but when I run it, it crashes.

Digging the problem, I found that if you use openGL under x11, no
graphic context is created :

[in SDL12/src/video/x11/SDL_x11video.c, ~line 800]

     /* Create the graphics context here, once we have a window */
     if ( flags & SDL_OPENGL ) {
             if ( X11_GL_CreateContext(this) < 0 ) {
                     return(-1);
             } else {
                     screen->flags |= SDL_OPENGL;
             }
     } else {
             XGCValues gcv;

             gcv.graphics_exposures = False;
             SDL_GC = XCreateGC(SDL_Display, SDL_Window,
                                GCGraphicsExposures, &gcv);
             if ( ! SDL_GC ) {
                     SDL_SetError("Couldn't create graphics context");
                     return(-1);
             }
     }

Now if I apply the attached patch, which creates a graphic context even
if openGL is used, testoverlay with openGL works fine.

Why isn’t the graphic context always created then ? Is there something
in x11 preventing this ?

Stephane
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: x11_gl_overlay.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040511/6797ed4f/attachment.txt