Hi everyone,
I'm running into problems when using a second NSOpenGLView: I've got a document-based app, each window uses an NSOpenGLView with a CVDisplayLink and its own NSOpenGLContext (no sharing). Open first document, everything works fine. Open second window: no-rendering happens (tabs still react, but the NSOpenGLView's content is not drawn). Same behavior when I disable tabbing and have each document open its own window. When I pause the debugger, both CVDisplayLink-threads are blocked in NSOpenGLContext flushBuffers.
Thread A's callstack:
__psynch_mutexwait
_pthread_mutex_lock_wait
_pthread_mutex_lock_slow
CGLGetSurface
flush_notify
glSwap_Exec
CGLFlushDrawable
[NSOpenGLContext flushBuffer]
...
Thread B's callstack:
__psynch_mutexwait
_pthread_mutex_lock_wait
_pthread_mutex_lock_slow
flush_notify
glSwap_Exec
CGLFlushDrawable
[NSOpenGLContext flushBuffer]
...
None of the other threads seem to do anything, the main thread is happily running the main event loop.
My code is based on the standard NSOpenGLView+CVDisplayLink code, so rendering happens like this:
- CGLLockContext
- make current context
- do rendering
- flushBuffer
- CGLUnlockContext
Anyone seen this behavior? I've searched around the net but haven't really found any clue...
Alex
P.S.: I've used the GLEssential sample code in order to reproduce the problem. I made a NSDocument-based version out of it, everything works fine. However, if I check the NSOpenGLView's box in the "core animation layer" panel, I get the same freeze as in my app. Problem is I haven't found anything in my app which could cause the view to be layer-backed... as far as I could narrow it down there seems to be some animation (which I didn't create) causing the NSOpenGLView to becomes layer-backed.