<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [vtkusers] Problem with VTK4.4 + BCB6 + WinXP Pro</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi Dean,</FONT>
</P>

<P><FONT SIZE=2>After playing around with Compiler and Linker settings, I fixed the problem by setting &quot;Data Alignment&quot; to &quot;Quad Word&quot; on the BCB6 Advanced Compiler settings. </FONT></P>

<P><FONT SIZE=2>Regards.</FONT>
</P>

<P><FONT SIZE=2>Yang</FONT>
</P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Xianjin Yang [<A HREF="mailto:Yang@AGIUSA.COM">mailto:Yang@AGIUSA.COM</A>] </FONT>
<BR><FONT SIZE=2>Sent: Monday, March 29, 2004 12:58 PM</FONT>
<BR><FONT SIZE=2>To: vtkusers archive</FONT>
<BR><FONT SIZE=2>Cc: 'Dean Inglis'</FONT>
<BR><FONT SIZE=2>Subject: [vtkusers] Problem with VTK4.4 + BCB6 + WinXP Pro</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi Dean, </FONT>
<BR><FONT SIZE=2>To demo the problem with VTK4.4 + BCB6, I created a small demo out of VTK\Examples\GUI\Win32\vtkBorland\ProjectDemo\Project_vtkDemo&nbsp; and&nbsp; /VTK/Examples/DataManipulation/Cxx/Arrays.cxx. I simply replaced the the button event handler with Arrays.cxx.</FONT></P>

<P><FONT SIZE=2>When my demo program calls vtkCellArray-&gt;InsertNextCell(4), I got an Excess Violation. BCB error message says </FONT>
<BR><FONT SIZE=2>&quot;Access violation at the address 0040263F in module Project_vtkDemo.exe. Write of address 00000000.&quot; The BCB debugger pointed to the error code in VTK below:</FONT></P>

<P><FONT SIZE=2>inline void vtkIdTypeArray::InsertValue(vtkIdType id, vtkIdType i) </FONT>
<BR><FONT SIZE=2>{ </FONT>
<BR><FONT SIZE=2>&nbsp; if ( id &gt;= this-&gt;Size ) </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; { </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; this-&gt;ResizeAndExtend(id+1); </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; } </FONT>
<BR><FONT SIZE=2>&nbsp; this-&gt;Array[id] = i;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;------------ Error code inside VTK </FONT>
<BR><FONT SIZE=2>&nbsp; if ( id &gt; this-&gt;MaxId ) </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; { </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; this-&gt;MaxId = id; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; } </FONT>
<BR><FONT SIZE=2>} </FONT>
<BR><FONT SIZE=2>FYI, I had no problem to run the TCL version of the same code /VTK/Examples/DataManipulation/TCL/Arrays.tcl under VTK4.4.</FONT></P>

<P><FONT SIZE=2>Thank you for your time. </FONT>
<BR><FONT SIZE=2>Yang </FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>----------- My Demo Code Below ----------- </FONT>
<BR><FONT SIZE=2>void __fastcall TVTK_Form::bc1Click(TObject *Sender) </FONT>
<BR><FONT SIZE=2>{ </FONT>
<BR><FONT SIZE=2>&nbsp; vtkFloatArray* pcoords = vtkFloatArray::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; pcoords-&gt;SetNumberOfComponents(3); </FONT>
<BR><FONT SIZE=2>&nbsp; pcoords-&gt;SetNumberOfTuples(4); </FONT>
<BR><FONT SIZE=2>&nbsp; float pts[4][3] = { {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {1.0, 0.0, 0.0}, {1.0, 1.0, 0.0} }; </FONT>
<BR><FONT SIZE=2>&nbsp; for (int i=0; i&lt;4; i++) pcoords-&gt;SetTuple(i, pts[i]); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkPoints* points = vtkPoints::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; points-&gt;SetData(pcoords); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkCellArray* strips = vtkCellArray::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;InsertNextCell(4);&nbsp;&nbsp;&nbsp; &lt;------------------ Caused Access Violation </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;InsertCellPoint(0); </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;InsertCellPoint(1); </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;InsertCellPoint(2); </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;InsertCellPoint(3); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkIntArray* temperature = vtkIntArray::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;SetName(&quot;Temperature&quot;); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;InsertNextValue(10); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;InsertNextValue(20); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;InsertNextValue(30); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;InsertNextValue(40); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkDoubleArray* vorticity = vtkDoubleArray::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;SetName(&quot;Vorticity&quot;); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;InsertNextValue(2.7); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;InsertNextValue(4.1); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;InsertNextValue(5.3); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;InsertNextValue(3.4); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkPolyData* polydata = vtkPolyData::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; polydata-&gt;SetPoints(points); </FONT>
<BR><FONT SIZE=2>&nbsp; polydata-&gt;SetStrips(strips); </FONT>
<BR><FONT SIZE=2>&nbsp; polydata-&gt;GetPointData()-&gt;SetScalars(temperature); </FONT>
<BR><FONT SIZE=2>&nbsp; polydata-&gt;GetPointData()-&gt;AddArray(vorticity); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; mapper-&gt;SetInput(polydata); </FONT>
<BR><FONT SIZE=2>&nbsp; mapper-&gt;SetScalarRange(0, 40); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkActor* actor = vtkActor::New(); </FONT>
<BR><FONT SIZE=2>&nbsp; actor-&gt;SetMapper(mapper); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkWindow1-&gt;GetRenderer()-&gt;AddActor(actor); </FONT>
<BR><FONT SIZE=2>&nbsp; pcoords-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; points-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; strips-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; temperature-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; vorticity-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; polydata-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; mapper-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; actor-&gt;Delete(); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkWindow1-&gt;GetRenderer()-&gt;ResetCamera(); </FONT>
<BR><FONT SIZE=2>&nbsp; vtkWindow1-&gt;Invalidate(); </FONT>
<BR><FONT SIZE=2>} </FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message----- </FONT>
<BR><FONT SIZE=2>From: Dean Inglis [<A HREF="mailto:dean.inglis@camris.ca">mailto:dean.inglis@camris.ca</A>] </FONT>
<BR><FONT SIZE=2>Sent: Monday, March 29, 2004 10:56 AM </FONT>
<BR><FONT SIZE=2>To: vtkusers archive </FONT>
<BR><FONT SIZE=2>Cc: Yang@AGIUSA.COM </FONT>
<BR><FONT SIZE=2>Subject: Re: [vtkusers] Display model coordinate with vtkImagePlaneWidget </FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi Yang, </FONT>
<BR><FONT SIZE=2>&gt;continuous cursoring is found in vtk4.4 and up, but I could not make my </FONT>
<BR><FONT SIZE=2>BCB6 </FONT>
<BR><FONT SIZE=2>&gt;project to work with vtk4.4. I am still using vtk4.2. This may be </FONT>
<BR><FONT SIZE=2>&gt;another sign to abandon BCB. </FONT>
<BR><FONT SIZE=2>that's odd.&nbsp; 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).&nbsp; What specific problems are you having?</FONT></P>

<P><FONT SIZE=2>Dean </FONT>
</P>

</BODY>
</HTML>