About depth texture

Started by
3 comments, last by KumGame07 14 years ago
Guys, I have some problem with depth textures. The platform on which I am working does not support depth textures. However, FBO is supported on it. My question is, can we replace use render targets instead of using depth texture ? Maybe my question is not clear. So let me put some code to make it more clear.

glBindTexture(GL_TEXTURE_2D, depthTexID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, WIDTH, HEIGHT, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthTexID, 0);

The above one is what not supported !! Can I use something like

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rboId);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, WIDTH, HEIGHT);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId);

If so, how can I get the rendered depth info from the depth render buffer, rboId ?
Best Regards,KumGame07
Advertisement
How did you reach the conclusion that depth textures aren't supported? The FBO spec doesn't allow that. I think you forgot to set the MIN/MAG filters to something like GL_NEAREST to make your depth texture work.
Well, its not supported. I did not mention that I am working on OGLES. Depth texture creation fails for almost all possible combination of formats. I will have a check again on it.
Best Regards,KumGame07
Again. How are you checking that's unsupported? What fails? From the GL_OES_framebuffer_object spec:

       The following formats are required:                Sized                 Base                                  Internal Format       Internal format                      ---------------       ---------------                       RGB565_OES            RGB                                RGBA4_OES             RGBA                RGB5_A1_OES           RGBA                DEPTH_COMPONENT16_OES DEPTH_COMPONENT


So, GL_DEPTH_COMPONENT16_OES is required and must work if the FBO extension is supported. So, you must be doing something wrong, or there is a bug in your GL ES implementation.

Posting code would allow us to help you :)
I was using DEPTH_COMPONENT24_OES as the format :( I changed it to "SOMETHING" and it did the trick. Right now I am not in my place and I will post the code soon. About checking, I was doing glGetError().

Thanks a lot "HuntsMan" for replies.
Best Regards,KumGame07

This topic is closed to new replies.

Advertisement