PDA

View Full Version : glCheckFramebufferStatus returns 0



newbiecow
01-13-2013, 07:59 AM
I have created fbo using the following code:


glGenRenderbuffersEXT(NumRenderbuffers,stencilExpa nsionAuxiliaryRenderbuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,stencilE xpansionAuxiliaryRenderbuffer[Color]);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_RG BA8,window.width,window.height);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,stencilE xpansionAuxiliaryRenderbuffer[DepthAndStencil]);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_DE PTH24_STENCIL8_EXT,window.width,window.height);
glGenFramebuffersEXT(1,&stencilExpansionAuxiliaryFramebuffer);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,stenc ilExpansionAuxiliaryFramebuffer);
glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_E XT,GL_COLOR_ATTACHMENT0_EXT,GL_RENDERBUFFER_EXT,st encilExpansionAuxiliaryRenderbuffer[Color]);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL _DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,stencilE xpansionAuxiliaryRenderbuffer[DepthAndStencil]);
CHECK_ERR;
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL _STENCIL_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,stenci lExpansionAuxiliaryRenderbuffer[DepthAndStencil]);


And I have used this fbo in display loop as the following code:


glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,stenc ilExpansionAuxiliaryFramebuffer);
CHECK_DRAW_FRAME_BUFFER_STATUS(value,ErrorMessage)
CHECK_ERR;
......


The first time glBindFramebufferEXT is called and it's OK.
The second time glBindFramebufferEXT is called but both glCheckFramebufferStatus and glGetError returns 0.

How can this be? Thanks in advance!