[vtkusers] Access violation in destructor of vtkBorlandRenderWindow

Mattias Bair Mattias.Bair at umit.at
Thu Feb 23 04:48:17 EST 2006


Dear vtk users,

I'm using the borland render window package out of the examples of
version 4.4.2. I have compiled and installed the window successfully and
can draw any vtk components. For this purpose I've added the
vtkBorlandRenderWindow on my form but if the program terminates I'll get
an access violation due to writing in null space. In my case I've used a
PolyDataMapper so the error occurs in the class PolyData. I've found the
following issue in the newsgroup which should solve my problem. Instead
after trying this possible solution the problem still occurs.




Here's the issue:

Yang,

one thing you should do with vtk/borland gui apps is in the destructor
of the form that contains the renderwindow component, do something along
the following lines:

void __fastcall TMainForm::FormDestroy(TObject *Sender) {
  vtkRenderer* ren = m_BorlandRenderWindow->GetRenderer();
  ren->GetProps()->RemoveAllItems();

  vtkRenderWindow* renwin = m_BorlandRenderWindow->GetRenderWindow();
  m_Actor->ReleaseGraphicsResources(renwin);
  
  m_Actor->Delete();
}

I would still say it is necessary to modify or subclass this component
to set/get multiple renderers though...

Dean

> 
> From: Xianjin Yang <Yang at AGIUSA.COM>
> Date: 2003/08/29 Fri AM 10:46:48 GMT-04:00
> To: "'dean.inglis at camris.ca'" <dean.inglis at camris.ca>,  vtkusers

> at vtk.org
> Subject: RE: [vtkusers] Add two renderers to vtkBorlandRenderWindow
> 
> Hi Dean,
> 
> Thanks for your advice. In the demo project of vtkBorlandRenderWindow,

> I found that one can do something like this
> 
> BorlandRenderWindow->GetRenderWindow()->AddRenderer(ren1);
> 
> I got what I expected on the screen by doing this. But I got access 
> violation errors in several OpenGL-related vtk classes when I exited
my program.
> 
> Is it OK to add another renderer this way? Say,
> BorlandRenderWindow->GetRenderWindow()->AddRenderer(ren2);
> 
> When I do this: BorlandRenderWindow->GetRenderer(), I do not know 
> which renderer I would end up with.
> 
> Yang
> 
> 
> -----Original Message-----
> From: dean.inglis at camris.ca [mailto:dean.inglis at camris.ca]
> Sent: Friday, August 29, 2003 9:14 AM
> To: vtkusers at vtk.org
> Subject: Re: [vtkusers] Add two renderers to vtkBorlandRenderWindow
> 
> 
> 
> Hi Yang,
> 
> Take a look at  
> /Examples/GUI/Win32/vtkBorland/Package/vtkBorlandRenderWindow.h
> 
> You should note that there is only one render window, and one 
> renderer.  There currently is no API for adding renderers, although 
> this could be done by adding a vtkRendererCollection member item to 
> this class.  If you are interested in doing this you could create your

> own a modified vtkBorlandRenderWindow, or just drop two
vtkBorlandRenderWindow on your project's form ...
> 
> Dean
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



Has anybody an idea which components should be deleted manually and in
which way. What's the problem here? Please send me if possible a
detailed description.

Kind regards,
Mattias



More information about the vtkusers mailing list