PDA

View Full Version : Depth FBO problem



Fitz
11-17-2008, 11:27 AM
I have created a depth texture only FBO(not a renderbuffer).

OGL say it is a valid FBO, but when I bind it and attempt to render anything to it, the results are actually drawn to the standard back buffer's depth buffer instead.

Now my FBO is valid and bound... am I missing something? FBO's have always worked fine for me before, but I have never done a depth only one...

Thanks

Jackis
11-18-2008, 05:01 AM
Fitz,

could you please post some code. It's rather hard to tell smth without any information.

alder
11-18-2008, 09:01 AM
You have disabled color buffer related operations for the FBO?


glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

MZ
11-18-2008, 12:00 PM
I experienced problems with depth-only FBO too. Maybe it's related to yours, or maybe it isn't.

My problem is sensitive to combination of HW and driver:

GeForce 8 + 17x.xx driver - ok
GeForce 7 + 17x.xx driver - corrupted depth buffer
GeForce 7 + 9x.xx driver - ok

The corruption appears as blocky low-res patterns of junk, while most of the screen is ok. When I resize main window to match it's width with the size of my shadowmap depth buffer, the junk aligns so that I can almost see pixelated contents of my shadowmap on the screen, as if it was errornously used as the main depth buffer. Looks as if the driver allocated the same memory region for both depth buffers. Too agresive optimization?

I discovered two ways to modify code to make the corruption not occur. One is to attach a dummy color buffer to the FBO, so that the FBO is no longer depth-only (just be cautious to not attach a texture you might be reading from, during the time the FBO is bound). The other workaround is more interesting, but a bit more complicated to describe.

MZ
11-18-2008, 12:07 PM
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE); Depth-only FBO would fail to pass validation without that code.

Jackis
11-19-2008, 05:18 AM
For me, I didn't discover any problems with depth-only FBO on any nVidia hardware and with any rather fresh drivers.
One thing to mention - when I create FBO, I create dummy color texture firstly, and force it to bind to color attachment, then binding zero texture there. So, in fact, I have depth-only FBO.
I don't remember actually, why I did this magic with dummy texture binding/unbinding.