Depth Buffer

Just posting to see if anyone has had luck adding a depth buffer.

I saw balasan’s post here: http://forum.openframeworks.cc/t/of-and-iphone-os-4.0/4185/0

which seems to follow about what apple’s instructions say: http://developer.apple.com/library/ios/-…-texts.html

I tried implementing this but I’ve had no luck :frowning: just ending up with a black screen.

has anyone succeeded in adding a depth buffer?

solved. for future people:

look at balasan’s post. the only difference is the code in resizeFromLayer should look like this:

  
  
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);  
    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);  
    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);  
	  
	  
	if( ! depthRenderbuffer )  
		glGenRenderbuffersOES(1, &depthRenderbuffer);  
	  
	glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);  
	glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);  
	glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);  
	  
	// bind color buffer  
	glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);