FBOs: depth but no color

Started by
0 comments, last by DamonBlanchette 12 years, 8 months ago
Hi all, besides wishing I was at SIGGRAPH right now, I'm working on a project where I'm rendering things to a framebuffer object. Currently I'm getting depths to show up, but not color.

Is there anything in particular that might cause this to happen? The color texture is a regular old GL_TEXTURE_2D with type GL_RGB32F_ARB. Of course the depth texture is GL_TEXTURE_2D and type GL_DEPTH_COMPONENT.

I'm attaching both of them to the framebuffer with:
glFramebufferTexture(GL_FRAMEBUFFER, attachmentType, texObj->getTexID(), 0);

Where attachmentType is GL_COLOR_ATTACHMENT0 for the color texture and GL_DEPTH_ATTACHMENT for the depth texture.

When I put those textures on a quad to view them, the color texture is always just black and the depth texture always shows up perfectly. I get no OpenGL errors. I've tried adding and removing the "EXT" from the end of the functions and constants, but that doesn't help. I've tried other texture types such as GL_RGBA8, GL_RGB32F, and GL_RGB16F_ARB.

I'm running Windows 7, OpenGL 3.3, GLSL 3.3, and a nVidia GeForce 8600M GT video card. This exact same code worked just fine on a newer ATI card, but not on this slightly older (but only by a couple years) nVidia card.
Advertisement
I'll reply to my own post here to say I figured it out. While creating the textures, I was calling

glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);

AFTER the glTexImage2D() function call. When I moved it above glTexImage2D(), everything started working. That caused no problems on the ATI card or drivers, but the nVidia card or drivers didn't like it. Amazing.

This topic is closed to new replies.

Advertisement