[SDL] Which platforms can do OpenGL outside the main thread? Will SDL support that? (Re: SDL OpenGL context and threads)
havoc at ghdigital.com
Fri Dec 31 12:17:24 PST 2010
On 12/31/2010 08:33 AM, Martin wrote:
> 1. Which platforms allow using OpenGL in a single thread that isn't the main thread?
I can't answer this in any sort of official capacity, but from my porting experience on QuakeLive (which does not use SDL, due to the way the plugin API works), I can provide a bit of insight on which
platforms support this and which do not, at the API level (not SDL).
Windows - Full support, events are polled so they are delivered to whichever thread chooses to poll them.
Linux - You have to enable threaded Xlib, but no real problems, events are delivered by polling so they are delivered to whichever thread chooses to poll them.
Mac OS X - No support whatsoever. All API calls must be made from the main thread, this is due primarily to the way the event handling works, using a temporary zone (clustered memory allocator that
is freed after every event is processed), which all API calls utilize (in a non-thread-safe way). Even closing a window will crash if done from another thread (contrary to the documentation).
Again this is merely my observations on the API level, not SDL.
> 2. Will SDL officially support using this capability where it exists?
I do not expect SDL support this feature because of the OSX issues, but I do not speak for the SDL team, so this is only my opinion.
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier
More information about the SDL