[vtk-developers] Sitching to offscreen rendering exits application.

Jenya Burstein taijinian at gmail.com
Wed Aug 17 20:52:35 EDT 2011


 It appears that VTK doesn’t support handling of OpenGL failures. At least
in the context of trying to enable offscreen rendering. Even if I prevent
VTK from exitting the application, it presses on with attempting to
initialize the OpenGL context after a failure occurred. That eventually
blows with a dereference of a NULL pointer.

Is that a known issue? Should an attempt to be made to support OpenGL
failures more gracefully?

Any advice is much appreciated,
Jenya Burstein


On Wed, Aug 17, 2011 at 5:10 PM, Jenya Burstein <taijinian at gmail.com> wrote:

> Hello,
>
> I've ran into an issue of VTK exiting the application if an offscreen
> rendering is requested for a large size render window. VTK has a very
> unforgiving error handling. It displays a system message box (at least on
> Windows) and then calls exit(1) if there are no vtkCommand::ExitEvent
> observers. Even if I install my own ExitEvent observer, VTK will still
> present a rather user-unfriendly "ChoosePixelFormat failed." message.
> Ideally, clients of VTK would want to handle the error in their own way. Is
> there a reason why VTK doesn't simply invoke vtkCommand::ErrorEvent?
>
> Best Regards,
> Jenya Burstein
>
> void vtkWin32OpenGLRenderWindow::SetupPixelFormat(HDC hDC, DWORD dwFlags,
>                                                   int debug, int bpp,
>                                                   int zbpp)
> {
> ....
>     pixelFormat = ChoosePixelFormat(hDC, &pfd);
>     if (pixelFormat == 0)
>       {
> #ifdef UNICODE
>       MessageBox(WindowFromDC(hDC), L"ChoosePixelFormat failed.", L"Error",
>                  MB_ICONERROR | MB_OK);
> #else
>       MessageBox(WindowFromDC(hDC), "ChoosePixelFormat failed.", "Error",
>                  MB_ICONERROR | MB_OK);
> #endif
>       if (this->HasObserver(vtkCommand::ExitEvent))
>         {
>         this->InvokeEvent(vtkCommand::ExitEvent, NULL);
>         return;
>         }
>       else
>         {
>         exit(1);
>         }
>       }
> ....
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110817/067e63e3/attachment.html>


More information about the vtk-developers mailing list