FBO Depth Texture display

Hello all,

Sorry for posting such a obvious question, but I am willing to confirm a FBO depth texture behavior.

In order to have a depth test on the FBO you create, you need to have a depth buffer or texture. So if FBO color buffer displays correctly, means that the depth buffer/texture is performing as it should since depth test was passed.

The reason I am asking this, is due to a FBO behavior I am suffering. My color buffer is correctly been displayed on a quad as a texture, yet my depth texture is not. My main concern on this is that it should be displayed as a luminance texture on the quad, but the values are all 1.0. Looks like it was unused by the FBO when rendering.

Any hints on what may be happening?

Regards.

So if FBO color buffer displays correctly, means that the depth buffer/texture is performing as it should since depth test was passed.

According to the OpenGL spec, if there is no depth buffer on the current framebuffer, the depth test is always considered to be passed.

By passed I meant: Depth Test was enable and considered. Not passed by default. Default OpenGL behavior states that when there is no depth buffer (no matter if FBO or not) everything is draw without performing a depth test , thus passing it always.

My behavior is just the opposite, I can’t see my depth test texture, yet I think there is a depth test as the geometry is draw as it should. I was trying to confirm that this was the expected behavior on this case.

Anyway I’ve found my problem, there was always a texture been drawn correctly, my problem is the values of it. The range difference on the depth texture values between close pixels and those who hit the far clip plane, is barely noticeable. We are talking around 10^-4|5 values (AKA: 0.9999X - 1.0 ). Thus optical effect was full white screen. Now I need to see a way to normalize those values or any other solution. I am open to any suggestion.

EDIT: My far plane is 20, near plane is 1 and objecs are in between.

Solved: The problem comes on depth texture storing, it is exponential, so values need to be reset to a linear progression in order to be displayed and used correctly.