PDA

View Full Version : BlitFramebuffer only makes it to the screen every other time?



santana
03-05-2013, 05:20 PM
Hi All, I have a rendering pipeline which at the end of it does glBlitFramebufferEXT (it's part of a legacy code and must for backward compatibility use EXT). I have experienced a great deal of variety differences between platforms (linux+nvidia, mac+intel, windows+intel, mac+ati, etc). On a windows system with intel i7/hd4000(Intel GL 4.0.0 - Build 9.17.10.2932 GLSL 4.00 - Build 9.17.10.2932) the blit only makes it to the screen every other frame. I don't have this problem on my linux+nvidia, or mac+intel. Can anyone see what I'm doing wrong? Sorry in advance about the namespace and wrapped code.



// blit the result into the active fbo
// dest should be configured above us
// src from our cached textures
vtkFrameBufferObject *fbo = this->Internals->FBO;
fbo->SaveCurrentBindings();
fbo->Bind(vtkgl::FRAMEBUFFER_EXT);
fbo->AddDepthAttachment(vtkgl::READ_FRAMEBUFFER_EXT, this->Internals->DepthImage);
fbo->AddColorAttachment(vtkgl::READ_FRAMEBUFFER_EXT, 0U, this->Internals->RGBColorImage);
fbo->ActivateReadBuffer(0U);
fbo->DeactivateDrawBuffers();
vtkCheckFrameBufferStatusMacro(vtkgl::READ_FRAMEBU FFER_EXT);

vtkgl::BindFramebufferEXT(vtkgl::DRAW_FRAMEBUFFER_ EXT, prevFbo);
glDrawBuffer(prevDrawBuf);
glViewport(0, 0, viewsize[0], viewsize[1]);

fbo->Bind(vtkgl::READ_FRAMEBUFFER_EXT);

vtkgl::BlitFramebufferEXT(
0,0,viewsize[0]-1,viewsize[1]-1,
0,0,viewsize[0]-1,viewsize[1]-1,
GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT,
GL_NEAREST);

vtkOpenGLErrorMacro("failed at glFramebufferBlit");

fbo->Bind(vtkgl::FRAMEBUFFER_EXT);
#ifdef USE_DEPTH_TEXTURE
fbo->RemoveTexDepthAttachment(vtkgl::READ_FRAMEBUFFER_E XT);
#else
fbo->RemoveRenDepthAttachment(vtkgl::READ_FRAMEBUFFER_E XT);
#endif
fbo->RemoveTexColorAttachment(vtkgl::READ_FRAMEBUFFER_E XT, 0U);
fbo->DeactivateReadBuffer();
fbo->DeactivateDrawBuffers();

// reset
vtkgl::BindFramebufferEXT(vtkgl::READ_FRAMEBUFFER_ EXT, prevFbo);
vtkgl::BindFramebufferEXT(vtkgl::DRAW_FRAMEBUFFER_ EXT, prevFbo);
vtkgl::BindFramebufferEXT(vtkgl::FRAMEBUFFER_EXT, prevFbo);