Crash with SDL overlay and OpenGL undex X11

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/20030724/c29e996d/attachment.txt

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.

This isn’t portable, by the way. On most platforms you can’t use a YUV
overlay surface with OpenGL mode. Aside from video card limitations, if
hardware acceleration isn’t supported, the SDL YUV code falls back to a
software surface, and since there’s no direct pixel access, the updates
will fail.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment