Jump to content

  • Log In with Google      Sign In   
  • Create Account


Depth Buffer in OpenGL ES 2.0 on iOS


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 cHimura   Members   -  Reputation: 116

Like
0Likes
Like

Posted 11 April 2013 - 11:26 PM

Hi,

 

I want draw a cube with OpenGL ES 2.0 but I think that I have a problem with the depth buffer.

 

My cube looks that:

Captura_de_pantalla_2013_04_12_a_la_s_00

 

My setup buffers is

 

glGenFramebuffers(1, &defaultFramebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
    
glGenRenderbuffers(1, &colorRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
    
[context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
    
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
   
glViewport(0, 0, framebufferWidth, framebufferHeight);
glGenRenderbuffers(1, &depthRenderbuffer); 
glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer); 
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, framebufferWidth, framebufferHeight); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);

if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
   NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));

 

Can I help me??

 

Thanks!


Edited by cHimura, 11 April 2013 - 11:55 PM.


Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3344

Like
0Likes
Like

Posted 12 April 2013 - 02:38 AM

Just to make sure it's actually the depth-buffer failing, try glDisable(GL_CULL_FACE). The same error could result from your front-faces being the inside of the cube with culling enabled.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS