PDA

View Full Version : Possibly dumb question about FBOs



TomorrowPlusX
02-16-2009, 07:17 AM
I use FBOs for rendering reflections and the like to texture, and I also use depth-only FBOs for shadow mapping. It works pretty well, but my knowledge of them deep down is pretty poor.

The trouble is, from what I can tell FBOs allow for a single texture ( say, a color or depth texture ) and then various attachments. What I want is an FBO with a texture for color, and another texture for depth. Such that I can read from both textures for post-processing.

For example, a depth-of-field shader where I'd render a single pass of the scene, and then use GLSL to sample both the color & depth attachments.

Is this possible? I assume I'm just overlooking some aspect of the FBO API.

Thanks,


EDIT: Apparently, my first rounds of googling didn't suffice. I found example code here: http://www.gamedev.net/community/forums/topic.asp?topic_id=523491

As far as I can tell, it works. Or at least my color FBOs still have correct depth testing, and using Apple's GL Profiler, I see a depth component texture alongside my color texture. So I apologize for the above!