Skip to main content
gamedev.net
🔒 Locked

FBO Depth

Started by jmaupay Aug 30, 2006 at 4:57 AM 1 replies 1.2k views
Original Post
jmaupay
jmaupay
I have a Frame Buffer Object and I attach the DEPTH component to a texture. 1. Is the "resolution" of the frame buffer only specified by the size of the texture ? (i.e. :glTexImage2D) 2. For debug purpose, I want to see the depth texture as a grayscale texture, can I avoid a glGetTexImage or glDrawPixels and use directly the texture generated by the FBO (witout a shader) ? 3. Instead of attaching the DEPTH component to a texture, if I attach it to a RenderBuffer, can I acces to the RenderBuffer in a shader (GLSL). What are the pro/cons of rendering to a RenderBuffer anyway ?
jma
MARS_999
MARS_999
Quote:
Original post by jmaupay
I have a Frame Buffer Object and I attach the DEPTH component to a texture.

1. Is the "resolution" of the frame buffer only specified by the size of the texture ? (i.e. :glTexImage2D)

2. For debug purpose, I want to see the depth texture as a grayscale texture, can I avoid a glGetTexImage or glDrawPixels and use directly the texture generated by the FBO (witout a shader) ?

3. Instead of attaching the DEPTH component to a texture, if I attach it to a RenderBuffer, can I acces to the RenderBuffer in a shader (GLSL). What are the pro/cons of rendering to a RenderBuffer anyway ?


1. correct

2. I am assuming you are doing shadowmapping? If so just shutdown the comparision function with GL_NONE and bind the texture object you have for depth and use it

3. I personally use a depth texture attached to a RB and not the FB... AFAIK no access to the RB with GLSL...
jmaupay
jmaupay
Thank you for your answers.

2. yes I'm trying shadowmapping. And you are right, directly using the texture with depth components is working. I wonder why I missed that solutions ? Well probably because the texture declaration: glTexImage2D(TEXTURE_2D, 0, GL_DEPTH_COMPONENT, mWidth, mHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); does'nt look like a greyscale texture, but it is.

3. Ok I'm using the texture attachment then.
jma

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.