Rendering in thread other than main

Just to mention it, this commit should fix at least one crash on Mac if you’re rendering in a thread other than the main thread: http://hg.libsdl.org/SDL/rev/6abcf951af68

Previously, you might experience crashes when there were windowing events that caused the backing drawable to change position or size.

  • J?rgen.________________________________
    From: sdl-bounces@lists.libsdl.org [sdl-bounces at lists.libsdl.org] on behalf of Gabriele Greco [gabriele.greco at darts.it]
    Sent: Friday, August 02, 2013 8:22 AM
    To: SDL Development List
    Subject: Re: [SDL] Rendering in thread other than main

=/ That sounds really bad… I wonder how people even do stuff like multi-threaded
resource loading on OSX then. Looks like a very primitive implementation.

Here is an article about offloading texture/VBO creation to worker threads:

http://hacksoflife.blogspot.com/2009/08/creating-opengl-textures-or-vbox-on.htmlhttp://hacksoflife.blogspot.com/2009/08/updating-textures-on-fly-with-threads.html
http://hacksoflife.blogspot.com/2009/08/updating-textures-on-fly-with-threads.html

It requires multiple GL contexts and some atomic calls but it can be done, just remember to use glFlush :slight_smile:


Bye,
Gabry