Commit 05f87557cd broke our app, causes pure red view

Hi all,

Building our app against VTK master now results in all VTK views being pure opaque red instead of showing whatever they would normally show. We git bisected it to:

commit 05f87557cd9fb6c20486398e2088fd70418276a3 (HEAD)
Author: Utkarsh Ayachit <utkarsh.ayachit@kitware.com>

    vtkOpenGLRenderWindow: bind default frame buffer
    
    vtkOpenGLRenderWindow never bound the default frame buffer when
    rendering began. While this is generally not necessary, if for some
    reason the bound frame buffer is changed then vtkOpenGLRenderWindow ends
    up rendering to incorrect frame buffer. Fixed that.

At runtime we also get this logged:

vtkOpenGLState.cxx:624 WARN| Error glEnable/Disable1 OpenGL errors detected
0 : (1286) Invalid framebuffer operation

We’ll debug more next week, but, Utkarsh, do you think maybe this commit of yours in incorrect?

Thanks,

Sean

Is the default frame buffer being set to something other than 0 and that buffer is destroyed but the window not updated properly? I cannot think of reason why the change is incorrect, but it could very have exposed some other issue. More details about your app would help.

Hi Utkarsh,

 Kindly have a look at the following backtrace, it seems to me that the change introduced in the above mentioned commit by Sean is invalidating the current frame buffer by assuming it's best to bind the default, a test on our end suggests that the error we see occurs write in CAOpenGLLayer's drawIncontext way before any of other code of ours gets a chance to execute).

           #0	0x0000000104960501 in vtkOpenGLRenderWindow::Start() at /Users/seun/Documents/VTK/vtk/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx:1300
#1	0x000000010482cb8f in vtkCocoaRenderWindow::Start() at /Users/seun/Documents/VTK/vtk/Rendering/OpenGL2/vtkCocoaRenderWindow.mm:1042
#2	0x0000000104780cfd in vtkRenderWindow::DoStereoRender() at /Users/seun/Documents/VTK/vtk/Rendering/Core/vtkRenderWindow.cxx:305
#3	0x0000000104780c0e in vtkRenderWindow::Render() at /Users/seun/Documents/VTK/vtk/Rendering/Core/vtkRenderWindow.cxx:286
#4	0x000000010496603f in vtkOpenGLRenderWindow::Render() at /Users/seun/Documents/VTK/vtk/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx:2424
#5	0x0000000101245467 in -[BSStageViewLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:] at /Users/seun/Documents/RogueSVN3/Brainsight/src/Visualisation/BSStageViewLayer.m:80