[SDL] SDL1.3, OpenGL /w multi-window & texture sharing problem.

Campbell Barton ideasman42 at gmail.com
Tue Jul 12 17:59:58 PDT 2011


Hi, Yesterday I added support for blender3d to use SDL.
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38332

But I have run into a problem with multiple windows and multiple
OpenGL contexts.
There is no way to have multiple OpenGL windows share textures, this
is really important because in our case - text and icons wont show up
in the second window.

This is possible to do - see OpenGL FAQ and replies on stack-overflow.
  http://www.opengl.org/resources/faq/technical/texture.htm
  http://stackoverflow.com/questions/232271/opengl-textures-with-multiple-display-contexts

For X11, I compared our own code with SDL to check on how to fix,
With the latest checkout of SDL1.3 and currently there is no way to
set the 3rd argument to glXCreateContext.
m_context = glXCreateContext(m_display, m_visual, s_firstContext, True);


So I'd suggest an argument be added to SDL_GL_CreateContext, eg:
  SDL_GL_CreateContext(window, gl_share_context)

>From looking into osx, x11 and windows api's it should be possible to
get this working on all of them.
If this is deemed acceptable I can look into writing this as a patch.

To give some background on the topic if other devs are interested.
So far blender uses its own library for handling windowing in each OS
called 'GHOST' which was originally written as a replacement for GLUT
- X11/Windows/Cocoa/Carbon, this is not so bad because all it really
needs to do is events and setup an OpenGL context.
However it does make it harder to support other OS's.

-- 
- Campbell



More information about the SDL mailing list