View Full Version : Creating GL-Sharing context with SDL

02-16-2010, 10:57 AM

I'd like to create a cross-platform program with CL-GL-Interoperability and SDL.
To create a shared context I need to give the display within the context properties to clCreateContext. My problem is, that

is not cross-platform. Is there a SDL-equivalent?
I thougt that the return value of SDL_CreateWindow is my parameter but it is not the same as glXGetCurrentDisplay.
However, SDL_GL_CreateContext is the same as glXGetCurrentContext().

Someone has ideas?

02-17-2010, 10:06 PM
I'm not familiar with SDL but will point out that while glXGetCurrentDisplay isn't crossplatform, neither is its use in clCreateContext - you need to pass in either an (X Display, GLX Context handle) or (WGL hDC, WGL context handle) or (EGLDisplay, EGLContext handle) or other attributes to context creation, depending on the window system OpenGL is running within. So unless SDL has queries to return exactly that
information across platforms, you may need to poke at its internals a bit.

07-19-2010, 05:20 AM
In SDL there is SDL_GetWMInfo to get the window bits.... but to get the GL context via SDL, there is no call.... you will need to have the #ifdef bits in your code...