I'm building an app for Mac OS 10.6 that will use OpenGL. I'd like to offshore the rendering to a secondary dispatch queue (instead of the main thread).
From what I understand, I need to use a thread-local OpenGL context to do my graphics work. My plan is to acquire a reference to it on my first block, then reuse the same instance over and over again.
However, dispatch queues and threads aren't the same, and the debugger of Xcode 4 shows that a queue can use several threads. Therefore, I'm not sure if what I'm doing is safe (even though I believe that only parallel queues can use several threads).
Is there a guarantee that all blocks sent to a serial queue are sent to the same thread? Should I instead get the current OpenGL context and assign it to my NSOpenGLView
at each frame?