Framebuffer: Color and depth at same time

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.

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.

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.

There is no such thing as a “depth FBO” or a “color FBO”. There is only a Framebuffer Object, which can have color and/or depth images bound to it.

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?

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.

Thanks. Would this let me write to the color and depth textures in the same render call?

yes

Ok, I understand FBOs better now. I appreciate all the help.