Sign in to follow this  

OpenGL FBOs: depth but no color

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this