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

Mason Wheeler masonwheeler at yahoo.com
Tue Jul 12 18:27:35 PDT 2011


I would certainly find the ability to share textures between two different GL windows useful.  I vote yes.
Anyone else have any thoughts on this?



________________________________
From: Campbell Barton <ideasman42 at gmail.com>
Subject: [SDL] SDL1.3, OpenGL /w multi-window & texture sharing problem.

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
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110712/474da071/attachment-0008.htm>


More information about the SDL mailing list