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