[vtkusers] Using Borland BCC6 and VTK

Xianjin Yang Yang at AGIUSA.COM
Mon Dec 1 10:08:03 EST 2003


Hi Louis-Jacques,
 
You have done nothing wrong. To solve the crash problem in Project_vtkDemo,
remove the FormDestroy event. Instead, add this FormClose event.
 
void __fastcall TVTK_Form::FormClose(TObject *Sender, TCloseAction &Action)
{
  vtkWindow1->GetRenderer()->RemoveAllProps();
  
}

 
Yang
 
 
-----Original Message-----
From: Louis-Jacques Lalonde [mailto:lalond01 at gel.ulaval.ca] 
Sent: Saturday, November 29, 2003 1:07 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Using Borland BCC6 and VTK


Hi !
 
First, thanks for taking time to read my message.  Since 2-3 days I'm trying
to use VTK with Borland C++ Builder 6 (with patch #4).
 
I downloaded the latest version of VTK source (4.2.4)
I downloaded the latest version of Cmake (1.8.2)
I used CMake to build a Borland makefile
I used make.exe from Borland to compile everything.
 
I didn't get any errors.  My problem is when I try to use VTK in Borland.  I
want to make a GUI with a VTK window.
 
I found the component vtkBorlandRenderWindow in
/Examples/GUI/Win32/vtkBorland/
So I installed it.  It added correctly in the component bar.  When I try to
compile the demo programme I get this error.
 
The exception is raised at:
DummyCritSect.Lock();    // vtkPolyData::~vtkPolyData()
 
I have the VTK libs included in my project.
 
All my problems are when I close the form where is my vtkRenderWindow.  I
see the demo correctly, I can interact with the object in the Renderwindow,
but the program crash when I close the form.
 
I also tried to compile a older version of VTK(4.2.2) and I have the same
problem.
 
I tried to make a little program myself because I was thinking maybe the
component was the problem.
 
__fastcall TForm1::TForm1(TComponent* Owner)
     : TForm(Owner)
{
     renderer = vtkRenderer::New();
     renWin = vtkRenderWindow::New();
     renWin->AddRenderer(renderer);
 
     renWin->SetParentId(this->Handle);
     iren = vtkRenderWindowInteractor::New();
     iren->SetRenderWindow(renWin);
 
     cone = vtkConeSource::New();
     cone->SetHeight( 3.0 );
     cone->SetRadius( 1.0 );
     cone->SetResolution( 10 );
 
     coneMapper = vtkPolyDataMapper::New();
     coneMapper->SetInput(cone->GetOutput());
     coneActor = vtkActor::New();
     coneActor->SetMapper(coneMapper);
 
     renderer->AddActor(coneActor);
     renderer->SetBackground(0.2, 0.4, 0.3);
     renWin->SetSize(300, 300);
     renWin->SetPosition(0,0);
 
     cone->Delete();
     coneActor->Delete();
     coneMapper->Delete();
 
     renWin->Render();
}
void __fastcall TForm1::OnDestroy(TObject *Sender)
{
     iren->Delete();
     renderer->Delete();
     renWin->Delete();
}
 
It crash when I close the program.  If I follow the execution, the OnDestroy
ends, after the execution goes in vtkRenderer.h
void AddActor(vtkProp *p) {this->AddProp(p);}; and it's where it crash.
 
If anyone can help me, that would be very nice. I read everything I could
find in the mailing list without finding the solution.  Is it a problem with
my Borland C++ Builder or my CMake Build? Any particular option I should set
when I build a Borland Makefile?
 
Thanks,
 
Louis-Jacques Lalonde
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031201/1cae8628/attachment.htm>


More information about the vtkusers mailing list