View Full Version : Multiple context for one window in single thread

05-11-2012, 05:33 AM

I want to render to one window in a single thread with two different contexts, because state management in this case is much simpler for me. It works on Windows and Linux, but there's some problem with Mac. I use X11 for context management.

Here is a simple pseudo code snippet that demonstrates the problem:

makeCurrent(display, drawable, rc1);

float currTime = glutGet(GLUT_ELAPSED_TIME) / 1000.0f;
float red = 0.5f + 0.5f * sinf(currTime);

glClearColor(red, 0.0f, 0.0f, 1.0f);

//makeCurrent(display, drawable, rc2); // doesn't work on mac


If we uncomment the second makeCurrent call, it seems that the system doesn't refresh the window's contents properly: 714

I created a small test app that I attached.

Any help is appreciated.

05-11-2012, 10:04 AM
Apple has some problems with OpenGL, in addition, the X11 layer is deprecated and will get removed in the next MacOS X release. So if that's a problem on Apples side, it wont get fixed anymore.
You might want to test if rendering with multiple contexts works better in a cocoa based window (GLFW is simlar 'basic' as GLUT and uses cocoa internally for its Mac support, you might look up how they are doing the context creation). If you can reproduce problems in a cocoa based configuration, you can file a bug report at Apple and hope for a fix (that maybe even solves the problem in a X11 environment - I don't know if that mappes internally to cocoa). A X11 based bugreport will most likely get ignored.