Jump to content
  • Advertisement
Sign in to follow this  
DamonBlanchette

OpenGL FBOs: depth but no color

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!