Jump to content
  • Advertisement
Sign in to follow this  
KumGame07

About depth texture

This topic is 3015 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!