<div>hi, everyone</div>
<div>&nbsp;</div>
<div>Sorry to fill your mailbox and sorry to post same message again :(</div>
<div>&nbsp;</div>
<div>I am &nbsp;trying to visualize a float-point structured points data with size 119*195*90 using vtk(version 5.0) 's 3D texture mapping functionality. However, It always fails to exectute in vtkTextureMapper3DComputeScalars function with a Unhandle Execption error:(I am using MS Visual Studio. NET 2003 ,&nbsp; vtk Compiled with static library)
</div>
<div>&nbsp;</div>
<div><font color="#ff6600">Unhandled Execption at&nbsp;0x004614c8 &nbsp;in **.exe , 0xC00005 access violation reading location 0x04dca000</font></div>
<div><font color="#ff6600"></font>&nbsp;</div>
<div><font color="#000000">I have checked my simple source code&nbsp;a lot of &nbsp;times and&nbsp;traced it line by line&nbsp;every time&nbsp;, and&nbsp;compiled the VTK Source code a lot of l times also ―_―. T</font>he vtkTextureMapper3DComputeScalars always fails. &nbsp;I am sure my display card and it's driver 
</div>
<div>support 3d texture. Because my previous code (written by myself, do not using vtk) works very well using 3d texture and cg shader.</div>
<div>&nbsp;</div>
<div>By the way, I have also compiled the vtk source code using share libs several times&nbsp;,&nbsp; I am very sad to see that it also fails in vtkTxtureMapper3DComputeScalars.&nbsp; I am crazy now. </div>
<div>&nbsp;</div>
<div>Can anyone help me ?</div>
<div>&nbsp;</div>
<div>Best Regards, </div>
<div>berry </div>
<div>&nbsp;</div>
<div>below is my simple code : </div>
<div>&nbsp;</div>
<div>
<p>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkStructuredPointsReader.h&quot;<br>#include &quot;vtkPiecewiseFunction.h&quot;<br>#include &quot;vtkColorTransferFunction.h
&quot;<br>#include &quot;vtkVolumeProperty.h&quot;<br>#include &quot;vtkStructuredPoints.h&quot;<br>#include &quot;vtkImageData.h&quot;<br>#include &quot;vtkVolumeTextureMapper3D.h&quot;<br>#include &quot;vtkVolume.h&quot;
<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkLODProp3D.h&quot;<br>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;<br>#include &quot;vtkVolumeRayCastMapper.h
&quot;</p>
<p><br>#pragma comment(lib, &quot;vtkGraphics.lib&quot;)<br>#pragma comment(lib, &quot;vtkCommon.lib&quot;)<br>#pragma comment(lib, &quot;vtkRendering.lib&quot;)<br>#pragma comment(lib, &quot;vtkVolumeRendering.lib&quot;)
<br>#pragma comment(lib, &quot;vtkImaging.lib&quot;)<br>#pragma comment(lib, &quot;vtkHybrid.lib&quot;)<br>#pragma comment(lib, &quot;vtkIO.lib&quot;)<br>#pragma comment(lib, &quot;vtkFiltering.lib&quot;)</p>
<p>#pragma comment(lib, &quot;OpenGL32.lib&quot;)</p>
<p>&nbsp;</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br>{<br>&nbsp;vtkStructuredPointsReader* reader = vtkStructuredPointsReader::New();<br>&nbsp;reader-&gt;SetFileName(&quot;test.vtk&quot;);</p>
<p>&nbsp;vtkPiecewiseFunction* opacityTransferFunction = vtkPiecewiseFunction::New();<br>&nbsp;opacityTransferFunction-&gt;AddPoint(20,0.0);<br>&nbsp;opacityTransferFunction-&gt;AddSegment(20,0.0, 340,0.0);<br>&nbsp;opacityTransferFunction-&gt;AddSegment(340,
0.0,395,0.2);<br>&nbsp;opacityTransferFunction-&gt;AddSegment(395,0.2,460,0.0);<br>&nbsp;opacityTransferFunction-&gt;AddSegment(460,0.0, 1430,0.0);&nbsp;<br>&nbsp;opacityTransferFunction-&gt;AddSegment(1430,0.0,1464,0.2);<br>&nbsp;opacityTransferFunction-&gt;AddSegment(1464,
0.2,1511,0.0);</p>
<p><br>&nbsp;vtkColorTransferFunction* colorTransferFunction = vtkColorTransferFunction::New();<br>&nbsp;colorTransferFunction-&gt;AddRGBPoint(20.0, 0.0,0.0,1.0);<br>&nbsp;colorTransferFunction-&gt;AddRGBPoint(300.0, 0.0,0.0,0.7);<br>&nbsp;colorTransferFunction-&gt;AddRGBPoint(
1200.0, 0.0,0.7,0.0);<br>&nbsp;colorTransferFunction-&gt;AddRGBPoint(1400.0, 0.6,0.0,0.0);&nbsp;<br>&nbsp;colorTransferFunction-&gt;AddRGBPoint(1500.0, 0.8,0.0,0.0);<br>&nbsp;</p>
<p>&nbsp;vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();<br>&nbsp;volumeProperty-&gt;SetColor(colorTransferFunction);<br>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);<br>&nbsp;volumeProperty-&gt;SetInterpolationTypeToLinear();
</p>
<p>&nbsp;vtkVolumeTextureMapper3D* texMapper = vtkVolumeTextureMapper3D::New();<br>&nbsp;texMapper-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>&nbsp;texMapper-&gt;SetPreferredMethodToNVidia();<br>&nbsp;//texMapper-&gt;SetSampleDistance(
0.25);</p>
<p>&nbsp;vtkVolumeRayCastCompositeFunction* composite = vtkVolumeRayCastCompositeFunction::New();<br>&nbsp;vtkVolumeRayCastMapper* raycastMapper = vtkVolumeRayCastMapper::New();<br>&nbsp;raycastMapper-&gt;SetVolumeRayCastFunction(composite);
<br>&nbsp;raycastMapper-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>&nbsp;raycastMapper-&gt;SetNumberOfThreads(2);<br>&nbsp;raycastMapper-&gt;SetImageSampleDistance(0.5);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;vtkVolume* volume = vtkVolume::New();<br>&nbsp;volume-&gt;SetMapper(texMapper);
<br>&nbsp;//volume-&gt;SetMapper(raycastMapper);<br>&nbsp;volume-&gt;SetProperty(volumeProperty);</p>
<p>&nbsp;vtkRenderer* ren = vtkRenderer::New();<br>&nbsp;ren-&gt;AddVolume(volume);</p>
<p><br>&nbsp;vtkRenderWindow* renWin = vtkRenderWindow::New();<br>&nbsp;renWin-&gt;AddRenderer(ren);</p>
<p><br>&nbsp;vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();&nbsp;<br>&nbsp;iren-&gt;SetSize(800,600);<br>&nbsp;iren-&gt;SetRenderWindow(renWin);</p>
<p><br>&nbsp;iren-&gt;Initialize();<br>&nbsp;iren-&gt;Start();</p>
<p>&nbsp;ren-&gt;Delete();<br>&nbsp;iren-&gt;Delete();<br>&nbsp;renWin-&gt;Delete();<br>&nbsp;reader-&gt;Delete();<br>&nbsp;opacityTransferFunction-&gt;Delete();&nbsp;<br>&nbsp;volumeProperty-&gt;Delete();<br>&nbsp;texMapper-&gt;Delete();<br>&nbsp;composite-&gt;Delete();
<br>&nbsp;raycastMapper-&gt;Delete();<br>&nbsp;volume-&gt;Delete();<br>&nbsp;colorTransferFunction-&gt;Delete();<br>&nbsp;return 0;<br>}</p></div>
<div>&nbsp; </div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><br>Pang Shengyong <br><a href="mailto:berry_hust@hotmail.com">berry_hust@hotmail.com</a><br>Solidification&nbsp;&nbsp;Simulation Lab, Huazhong Univ. of Sci. &amp; Tech. <br><br>(Tel)+86-27-87541922<br><br>&nbsp;</div>