View Full Version : Framebuffer: Color and depth at same time
03-28-2012, 05:44 PM
Is it possible to draw to a color and depth buffer at the same time (using the same shader)? I have a feeling the answer will be no, but maybe there are some tricks I don't know about.
03-28-2012, 09:32 PM
What do you mean by that? It's generally quite hard to not render both color and depth at the same time. That is after all what you do normally. FBOs wouldn't be worth much if you couldn't use them with depth buffers.
03-28-2012, 09:56 PM
I'm looking at glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo) and I get the sense that only one FBO can bound for drawing at a time. I need to create a depth FBO and a color FBO, and I'm wondering if I can write to both in one fell swoop.
03-28-2012, 11:05 PM
There is no such thing as a "depth FBO" or a "color FBO". There is only a Framebuffer Object (http://www.opengl.org/wiki/Framebuffer_Object), which can have color and/or depth images bound to it.
03-28-2012, 11:14 PM
Ok, that is what I meant. Is there a way to write color and depth data to a single FBO? If not, is there a way to write each to a separate FBO but do so at the same time?
03-29-2012, 07:56 AM
You create a framebuffer object and attach images (textures) to it. So yes, you can attach upto 16 textures and 1 depth texture to the same fbo.
03-30-2012, 09:41 AM
Thanks. Would this let me write to the color and depth textures in the same render call?
03-30-2012, 09:58 AM
03-30-2012, 05:28 PM
Ok, I understand FBOs better now. I appreciate all the help.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.