[vtkusers] Problem with VTK4.4 + BCB6 + WinXP Pro

Xianjin Yang Yang at AGIUSA.COM
Mon Mar 29 13:58:28 EST 2004


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/9bf22591/attachment.htm>


More information about the vtkusers mailing list