Marjock
2006.07.15, 06:12 AM
Hey all,
I'm using NSOpenGL to try and set up a PBuffer in my game for things like water reflections.
I have successfully set up the PBuffer, and can successfully change between the PBuffer context and NSOpenGLView's context.
However, when I go to use what has been drawn to the PBuffer as a texture for my On Screen context (NSOpenGLView's context), I am told that I have an "Invalid Context State"
The code I use is the following:
[pBufferContext setTextureImageToPixelBuffer:pBuffer
colorBuffer:GL_FRONT];
Googling reveals this page: http://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html
Which states the following:
Invalid context state. This error occurs when a context state is inspected for readiness to switch renderers. To be in a valid state, a context be in render mode and have an attribute stack depth of 0, and a modelview, projection, and texture stack depth of 1.
Using glGetIntegerv, I've ascertained that my Attribute Stack Depth is zero and my modelview, projection and texture stack depths are all one.
It seems that that only leaves the possibility that the context is not in "Render Mode".
I don't know what it means for a context to be in Render Mode, so I am unable to check/correct that situation.
So, can anybody help me with a definition/check of/for "Render Mode" or suggest any other possibilities that might be causing an invalid context state?
Thanks heaps,
Mark
I'm using NSOpenGL to try and set up a PBuffer in my game for things like water reflections.
I have successfully set up the PBuffer, and can successfully change between the PBuffer context and NSOpenGLView's context.
However, when I go to use what has been drawn to the PBuffer as a texture for my On Screen context (NSOpenGLView's context), I am told that I have an "Invalid Context State"
The code I use is the following:
[pBufferContext setTextureImageToPixelBuffer:pBuffer
colorBuffer:GL_FRONT];
Googling reveals this page: http://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html
Which states the following:
Invalid context state. This error occurs when a context state is inspected for readiness to switch renderers. To be in a valid state, a context be in render mode and have an attribute stack depth of 0, and a modelview, projection, and texture stack depth of 1.
Using glGetIntegerv, I've ascertained that my Attribute Stack Depth is zero and my modelview, projection and texture stack depths are all one.
It seems that that only leaves the possibility that the context is not in "Render Mode".
I don't know what it means for a context to be in Render Mode, so I am unable to check/correct that situation.
So, can anybody help me with a definition/check of/for "Render Mode" or suggest any other possibilities that might be causing an invalid context state?
Thanks heaps,
Mark