PDA

View Full Version : rendering multiple OpenGL views within a single UIView (iOS)



cedoucette
05-03-2011, 04:37 PM
Our company has developed code to render a single (full-screen) 3D scene.
We wish to adapt that code to render two 3D scenes within the same iOS window (two UIViews using OpenGL ES).
I attempted to leverage the approach described by this example code:
http://gamesfromwithin.com/opengl-and-uikit-demo
That approach shared one context among two or more frame buffers.
During initialization, my current code generates the the frame buffers and checks that they were properly constructed.
Later - right before rendering - we attempt to rebind the frame buffer and color render buffer that corresponds to the target view.
The first attempt for the first view worked fine - but the second attempt for the second view failed.

glBindFramebufferOES(GL_FRAMEBUFFER_OES, buffer->m_frameBufferHandle);
CHECK_GL_ERRORS();

The CHECK_GL_ERRORS macro above generated the following log message:

2011-05-03 19:13:31.283 TestMorph[79963:40b] OpenGL: +[FrameBufferUtils Set:] [error 1281]

This means that glBindFramebufferOES returned
GL_INVALID_VALUE.

The manual page for glBindFramebuffer doesn't list that as a possible error.

Can anyone suggest steps to resolve this error (or another way to do what I am ultimately trying to accomplish)?

Thanks,
Chuck

cedoucette
05-09-2011, 07:21 AM
I have resolved my own problem.
The problem appeared to be related to calling: glBindFramebufferOES.
Instead - it was related to other calls where I hadn't detected the error
(specifically either glFrustumf or glRotatef).
My code now creates two distinct scenes in sub-views of the main view.

Thanks for reading.

Chuck