[vtkusers] Problem with VTK4.4 + BCB6 + WinXP Pro
Luca Picello
luca.picello at libero.it
Mon Mar 29 15:09:27 EST 2004
Well, I dont know the class you are using but here there are some tips
that can help you developing with BCB:
Usually this->Array[id] = i; means that Array should be allocated to
store at least number id items.
I mean that may be your code tries to assign a value (i) in a
non-existing item of the array(Array[id]).
TCL runtimes are different and it can be that they allocate more memory
than real needed (like visual basic does) and the exception is never
raised even the program is wrong.
Another good reason to use BCB is that you can check your code with
Codeguard built-in tool.
What is codeguard? It checks memory leaks and wrong memory accesses.
When an exception is raised (example Access violation at the address) it
shows you where and why it happened.
Try to activate it using Project->Options menu in the Codeguard tag.
Greeting,
Luca
PS: never mind about memory leaks it detects while exiting from a VTK
project: the vtkBorlandRenderWindow component have to be revisioned.
Xianjin Yang wrote:
> Hi Dean,
>
> To demo the problem with VTK4.4 + BCB6, I created a small demo out of
> VTK\Examples\GUI\Win32\vtkBorland\ProjectDemo\Project_vtkDemo and
> /VTK/Examples/DataManipulation/Cxx/Arrays.cxx. I simply replaced the
> the button event handler with Arrays.cxx.
>
> When my demo program calls vtkCellArray->InsertNextCell(4), I got an
> Excess Violation. BCB error message says
> "Access violation at the address 0040263F in module
> Project_vtkDemo.exe. Write of address 00000000." The BCB debugger
> pointed to the error code in VTK below:
>
> inline void vtkIdTypeArray::InsertValue(vtkIdType id, vtkIdType i)
> {
> if ( id >= this->Size )
> {
> this->ResizeAndExtend(id+1);
> }
> this->Array[id] = i; <------------ Error code inside VTK
> if ( id > this->MaxId )
> {
> this->MaxId = id;
> }
> }
>
> FYI, I had no problem to run the TCL version of the same code
> /VTK/Examples/DataManipulation/TCL/Arrays.tcl under VTK4.4.
>
> Thank you for your time.
>
> Yang
>
>
>
> ----------- My Demo Code Below -----------
>
> void __fastcall TVTK_Form::bc1Click(TObject *Sender)
> {
> vtkFloatArray* pcoords = vtkFloatArray::New();
> pcoords->SetNumberOfComponents(3);
> pcoords->SetNumberOfTuples(4);
> float pts[4][3] = { {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0},
> {1.0, 0.0, 0.0}, {1.0, 1.0, 0.0} };
> for (int i=0; i<4; i++) pcoords->SetTuple(i, pts[i]);
>
> vtkPoints* points = vtkPoints::New();
> points->SetData(pcoords);
>
> vtkCellArray* strips = vtkCellArray::New();
>
> strips->InsertNextCell(4); <------------------ Caused Access
> Violation
>
> strips->InsertCellPoint(0);
> strips->InsertCellPoint(1);
> strips->InsertCellPoint(2);
> strips->InsertCellPoint(3);
>
> vtkIntArray* temperature = vtkIntArray::New();
> temperature->SetName("Temperature");
> temperature->InsertNextValue(10);
> temperature->InsertNextValue(20);
> temperature->InsertNextValue(30);
> temperature->InsertNextValue(40);
>
> vtkDoubleArray* vorticity = vtkDoubleArray::New();
> vorticity->SetName("Vorticity");
> vorticity->InsertNextValue(2.7);
> vorticity->InsertNextValue(4.1);
> vorticity->InsertNextValue(5.3);
> vorticity->InsertNextValue(3.4);
>
> vtkPolyData* polydata = vtkPolyData::New();
> polydata->SetPoints(points);
> polydata->SetStrips(strips);
> polydata->GetPointData()->SetScalars(temperature);
> polydata->GetPointData()->AddArray(vorticity);
> vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
> mapper->SetInput(polydata);
> mapper->SetScalarRange(0, 40);
>
> vtkActor* actor = vtkActor::New();
> actor->SetMapper(mapper);
> vtkWindow1->GetRenderer()->AddActor(actor);
>
> pcoords->Delete();
> points->Delete();
> strips->Delete();
> temperature->Delete();
> vorticity->Delete();
> polydata->Delete();
> mapper->Delete();
> actor->Delete();
>
> vtkWindow1->GetRenderer()->ResetCamera();
> vtkWindow1->Invalidate();
> }
>
>
> -----Original Message-----
> From: Dean Inglis [mailto:dean.inglis at camris.ca]
> Sent: Monday, March 29, 2004 10:56 AM
> To: vtkusers archive
> Cc: Yang at AGIUSA.COM
> Subject: Re: [vtkusers] Display model coordinate with vtkImagePlaneWidget
>
>
> Hi Yang,
>
> >continuous cursoring is found in vtk4.4 and up, but I could not make my
> BCB6
> >project to work with vtk4.4. I am still using vtk4.2. This may be
> >another sign to abandon BCB.
>
> that's odd. I have about 6 different active projects that
> successfully compile and run error free both on BCB5 and BCB6 with
> latest cvs VTK release (Intel Pentium 4 processors, Windows 2000 OS).
> What specific problems are you having?
>
> Dean
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040329/dd1cb250/attachment.htm>
More information about the vtkusers
mailing list