[vtkusers] Error during cleanup: wglMakeCurrent failed in Clean()

Francois Bertel francois.bertel at kitware.com
Wed Nov 25 11:40:33 EST 2009


Hello,

Swap your two parts: delete the renderer first and then the renderwindow.


The reason is that RemoveAllViewProps() (implemented in
vtkViewport.cxx, superclass of vtkRenderer) calls
ReleaseGraphicsResources() on each prop which requires (indirectly) a
valid window. For example, a prop like vtkActor will call
ReleaseGraphicsResources() on its texture to release the OpenGL
texture object id.


On Wed, Nov 25, 2009 at 11:19 AM, Zamir Khan <zkhan at modusmed.com> wrote:
> I am seeing the following errors from a VTK 5 / MFC application when I close
> it:
>
> ERROR: In ..\..\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 113
> vtkWin32OpenGLRenderWindow (0685AF70): wglMakeCurrent failed in Clean(),
> error: 6
>
> ERROR: In ..\..\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 113
> vtkWin32OpenGLRenderWindow (0698BAE8): wglMakeCurrent failed in Clean(),
> error: 6
>
> The error will appear 2 or 3 times in the debug output file, depending on
> what actions I have taken in the program (I assume for the instances of
> vtkRenderWindow that are problematic). Also, I can only reproduce it on
> certain platforms (doesn't happen on machine with NVIDIA, but does on
> machine with Intel integrated graphics). I have searched the mailing list
> and the recommendation appears to be to make sure to Finalize() the
> vtkRenderWindow (there are 3 of them being instantiated in this
> application). In the destructor of each of the classes that instantiate
> vtkRenderWindows, I have the following code snippets:
>
>   if (renWin)
>   {
>       renWin->Finalize();
>       renWin->Delete();
>   }
>   if (renderer)
>   {
>       renderer->RemoveAllViewProps();
>       renderer->Delete();
>   }
>
> However, this does not resolve the issue. Any help is appreciated!
>
> Thanks,
> Zamir
>
> --
> Zamir Khan
> Modus Medical Devices
> e-mail: zkhan at modusmed.com
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list