Sign in to follow this  
KumGame07

About depth texture

Recommended Posts

KumGame07    145
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
HuntsMan    368
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
KumGame07    145
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
HuntsMan    368
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
KumGame07    145
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this