I'm trying to create an NSOpenGLContext, initialize my rendering engine, then create new NSOpenGLContexts using the share parameter from the first context. This doesn't work, and before I go on, what exactly is shared between a context? The documentation is a little light on this:
Shared contexts share all texture objects, display lists, vertex programs, fragment programs, and buffer objects created before and after sharing is initiated. The state of the objects is also shared but not other context state, such as current color, texture coordinate settings, matrix and lighting settings, rasterization state, and texture environment settings.
When I create my first NSOpenGLContext, I initialize my rendering engine, which makes the following types of calls:
- glGenTextures, glActiveTexture, glBindTexture
- glEnable
- glUseProgram, glGetAttribLocation, glGetUniformLocation
- glUniform1i, glUniform3f
- glGenVertexArraysAPPLE, glBindVertexArrayAPPLE, glBindBuffer
- glVertexAttribPointer, glEnableVertexAttribArray
Most of those are for three types of tasks - creating vertex and shader programs, storing reference to attrib and uniform locations within the programs, creating vertex arrays, and binding a few textures.
Would you expect all of these items to be shared across contexts?