[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtk-developers
Subject:    [vtk-developers] Sitching to offscreen rendering exits application.
From:       Jenya Burstein <taijinian () gmail ! com>
Date:       2011-08-18 0:10:23
Message-ID: CAN1xnwyj3SKWxoAbLrnrS-efRaZGPSd0LBv2NefMAbUvny6OJg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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);
        }
      }
....
}

[Attachment #5 (text/html)]

<div>Hello,</div><div> </div><div>I&#39;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 &quot;ChoosePixelFormat failed.&quot; message. Ideally, clients of \
VTK would want to handle the error in their own way. Is there a reason why VTK \
doesn&#39;t simply invoke vtkCommand::ErrorEvent?</div>

<div> </div><div>Best Regards,</div><div>Jenya Burstein</div><div> </div><div>void \
vtkWin32OpenGLRenderWindow::SetupPixelFormat(HDC hDC, DWORD dwFlags, <br>             \
int debug, int bpp, <br>

                                                  int \
zbpp)</div><div>{<br>....</div><div>    pixelFormat = ChoosePixelFormat(hDC, \
&amp;pfd);<br>    if (pixelFormat == 0)<br>      {<br>#ifdef UNICODE<br>      \
MessageBox(WindowFromDC(hDC), L&quot;ChoosePixelFormat failed.&quot;, \
L&quot;Error&quot;,<br>

                 MB_ICONERROR | MB_OK);<br>#else<br>      \
MessageBox(WindowFromDC(hDC), &quot;ChoosePixelFormat failed.&quot;, \
&quot;Error&quot;,<br>                 MB_ICONERROR | MB_OK);<br>#endif<br>      if \
(this-&gt;HasObserver(vtkCommand::ExitEvent))<br>

        {<br>        this-&gt;InvokeEvent(vtkCommand::ExitEvent, NULL);<br>        \
return;<br>        }<br>      else<br>        {<br>        exit(1);<br>        }<br>  \
}</div><div>....</div><div>}<br></div>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic