Jump to content
  • Advertisement
Sign in to follow this  
esr_ever

MRT & depth buffer problem in release only

This topic is 3884 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

hello, I've got a problem with my fbo setup which shows up only in release mode. I attach 4 GL_COLOR_ATTACHMENTs & I create 2 textures for depth & stencil renderbuffers, and while in debug it works correctly (I display the depth buffer tex and it's fine), in release the depth texture is blank, no depth information is written so my scene looks crap. I have an 7800 GS if it matters. Does anybody have any idea of what's going on?? I post the fbo creation code (the fbo class is taken from sourceforge-gpgpu) Thanks in advance!
glGenTextures(4, _bufferTexID); 

    // initialize the four mrt textures
    for(int i=0;i<4;i++)
    {
      glBindTexture(GL_TEXTURE_2D, _bufferTexID);
      // (set texture parameters here)
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
      //create the texture
      glTexImage2D(GL_TEXTURE_2D, 
				   0, 
				   GL_RGBA16F_ARB, 
				   Renderer::_mrtDims.x(), 
				   Renderer::_mrtDims.y(),
				   0, 
				   GL_RGBA, 
				   GL_FLOAT, 
				   0);
    }
      // Initialize the depth-stencil attachment
      glBindTexture(GL_TEXTURE_2D, _bufferTexID[4]);
      // (set texture parameters here)
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
      //create the texture
      glTexImage2D(GL_TEXTURE_2D, 
				   0, 
				   GL_DEPTH24_STENCIL8_EXT, 
				   Renderer::_mrtDims.x(), 
				   Renderer::_mrtDims.y(),
				   0, 
				   GL_DEPTH_STENCIL_EXT, 
				   GL_UNSIGNED_INT_24_8_EXT, 
				   0);

    _fbo.Bind(); // Bind framebuffer object.
    CHECK_GL_ERROR();

    // Attach texture to framebuffer color buffer
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[0], GL_COLOR_ATTACHMENT0_EXT);
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[1], GL_COLOR_ATTACHMENT1_EXT);
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[2], GL_COLOR_ATTACHMENT2_EXT);
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[3], GL_COLOR_ATTACHMENT3_EXT);
    // Attach depth & stencil texture
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[4], GL_DEPTH_ATTACHMENT_EXT);
    _fbo.AttachTexture(GL_TEXTURE_2D, _bufferTexID[4], GL_STENCIL_ATTACHMENT_EXT);

    _fbo.IsValid()
    // Disable FBO rendering for now...
    FramebufferObject::Disable();

Share this post


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