PDA

View Full Version : Attaching depth buffer cause a magenta screen



JoeCannatti
08-10-2010, 12:16 PM
Hello Everyone,

I have an OpenGL-ES 1.1 project for the iPad. I am having an issue that causes the full screen to be rendered magenta. It happens when I attach a depth buffer. If I do not attach the depth buffer everything renders as expected. NOTE: The clear color is not set to magenta.

Here is my setup code


glGenFramebuffersOES(1, &framebuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer);

glGenRenderbuffersOES(1, &colorRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGBA8_OES, screenWidth, screenHeight);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, colorRenderbuffer);

glGenRenderbuffersOES(1, &depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, screenWidth, screenHeight);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);

If I comment out the last four lines, things render correctly (without correct depth course)

Any help at all would be greatly appreicated.

JoeCannatti
08-10-2010, 01:41 PM
Also, on each render it is setting the error

GL_INVALID_FRAMEBUFFER_OPERATION (506)