The original value of vtkgl::BlendFuncSeparate is not restored by vtk after off screen rendering.
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Under certain conditions this causes a significant darkening of the model.
Our code to fix this bug
PFNGLBLENDFUNCSEPARATEPROC gOriginalCallback = 0; void MyViewClass::SetupMemoryRenderingWrapper(int x, int y, HDC prn) { gOriginalCallback = vtkgl::BlendFuncSeparate; this->RenderWindow->SetupMemoryRendering(x,y,prn); }
void MyViewClass::ResumeScreenRendering() { vtkgl::BlendFuncSeparate = gOriginalCallback; this->RenderWindow->CleanUpOffScreenRendering(); this->RenderWindow->ResumeScreenRendering(); /* NOTE: This describes a totally seperate issue that I have also identified however I am not certain that the fix described is the optimum fix.
Due to a change in the way vtk 6.1 implements
vtkWin32OpenGLRenderWindow::CleanUpRenderers we have to call
RenderWindow->ResumeScreenRendering() twice (the first call sets
RenderWindow::ContextId but does not set the internal render window.
The second call uses the new value of RenderWindow::ContextId to set the internal Render Window correctly.
*/
this->RenderWindow->ResumeScreenRendering(); }