Sign in to follow this  

MRT & depth buffer problem in release only

This topic is 3667 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[i]);
      // (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

This topic is 3667 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.

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