<div>Hi, all</div>
<div> </div>
<div>I have just updated vtk from 4.2 to 5.0. However, anytime when I build my previous code , the compiler tells me some codes in vtk5.0 has conflict with LIBC.lib , after turning on /NODEFAULTLIB:LIBC.lib options. this error has eliminated.
</div>
<div> </div>
<div> well, when I test a small program using vtkTextureMapper3D class, the program always fails with a access violation problem: </div>
<div>"Unhandled Execption at 0x0050bc8 in **.exe: 0xC00005, access violation..." while using the vtkTextureMapper2D, vtkRayCastVolumeMapper , this program works well. </div>
<div> </div>
<div>by the way, the volume data is a 90*195*115 one</div>
<div> </div>
<div>Does anyone can give some hints? </div>
<div> </div>
<div>thanks in advance</div>
<div> </div>
<div> </div>
<div>below is my code </div>
<div> </div>
<div>#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
"</div>
<div>
<p>#pragma comment(lib, "vtkGraphics.lib")<br>#pragma comment(lib, "vtkFiltering.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")</p>
<p>#pragma comment(lib, "OpenGL32.lib")<br>#pragma comment(lib, "glu32.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);</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->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>}<br></p><br>-- <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>