[vtkusers] conflict with LIBC.lib and vtkTextureMapper3D always fails on vc 2003
berry
lua.byhh at gmail.com
Wed Mar 29 09:46:14 EST 2006
Hi, all
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.
well, when I test a small program using vtkTextureMapper3D class, the
program always fails with a access violation problem:
"Unhandled Execption at 0x0050bc8 in **.exe: 0xC00005, access
violation..." while using the vtkTextureMapper2D, vtkRayCastVolumeMapper ,
this program works well.
by the way, the volume data is a 90*195*115 one
Does anyone can give some hints?
thanks in advance
below is my code
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkStructuredPointsReader.h"
#include "vtkPiecewiseFunction.h"
#include "vtkColorTransferFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkStructuredPoints.h"
#include "vtkImageData.h"
#include "vtkVolumeTextureMapper3D.h"
#include "vtkVolume.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderWindow.h"
#include "vtkLODProp3D.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkVolumeRayCastMapper.h"
#pragma comment(lib, "vtkGraphics.lib")
#pragma comment(lib, "vtkFiltering.lib")
#pragma comment(lib, "vtkCommon.lib")
#pragma comment(lib, "vtkRendering.lib")
#pragma comment(lib, "vtkVolumeRendering.lib")
#pragma comment(lib, "vtkImaging.lib")
#pragma comment(lib, "vtkHybrid.lib")
#pragma comment(lib, "vtkIO.lib")
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "glu32.lib")
int _tmain(int argc, _TCHAR* argv[])
{
vtkStructuredPointsReader* reader = vtkStructuredPointsReader::New();
reader->SetFileName("test.vtk");
vtkPiecewiseFunction* opacityTransferFunction =
vtkPiecewiseFunction::New();
opacityTransferFunction->AddPoint(20,0.0);
opacityTransferFunction->AddSegment(20,0.0, 340,0.0);
opacityTransferFunction->AddSegment(340,0.0,395,0.2);
opacityTransferFunction->AddSegment(395,0.2,460,0.0);
opacityTransferFunction->AddSegment(460,0.0, 1430,0.0);
opacityTransferFunction->AddSegment(1430,0.0,1464,0.2);
opacityTransferFunction->AddSegment(1464,0.2,1511,0.0);
vtkColorTransferFunction* colorTransferFunction =
vtkColorTransferFunction::New();
colorTransferFunction->AddRGBPoint(20.0, 0.0,0.0,1.0);
colorTransferFunction->AddRGBPoint(300.0, 0.0,0.0,0.7);
colorTransferFunction->AddRGBPoint(1200.0, 0.0,0.7,0.0);
colorTransferFunction->AddRGBPoint(1400.0, 0.6,0.0,0.0);
colorTransferFunction->AddRGBPoint(1500.0, 0.8,0.0,0.0);
vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();
volumeProperty->SetColor(colorTransferFunction);
volumeProperty->SetScalarOpacity(opacityTransferFunction);
volumeProperty->SetInterpolationTypeToLinear();
vtkVolumeTextureMapper3D* texMapper = vtkVolumeTextureMapper3D::New();
texMapper->SetInputConnection(reader->GetOutputPort());
texMapper->SetSampleDistance(0.25);
//vtkVolumeRayCastCompositeFunction* composite =
vtkVolumeRayCastCompositeFunction::New();
// vtkVolumeRayCastMapper* raycastMapper = vtkVolumeRayCastMapper::New();
//raycastMapper->SetVolumeRayCastFunction(composite);
//raycastMapper->SetInputConnection(reader->GetOutputPort());
// raycastMapper->SetNumberOfThreads(2);
//raycastMapper->SetImageSampleDistance(0.5);
vtkVolume* volume = vtkVolume::New();
volume->SetMapper(texMapper);
//volume->SetMapper(raycastMapper);
volume->SetProperty(volumeProperty);
vtkRenderer* ren = vtkRenderer::New();
ren->AddVolume(volume);
vtkRenderWindow* renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetSize(800,600);
iren->SetRenderWindow(renWin);
iren->Initialize();
iren->Start();
ren->Delete();
iren->Delete();
renWin->Delete();
reader->Delete();
opacityTransferFunction->Delete();
volumeProperty->Delete();
texMapper->Delete();
//composite->Delete();
//raycastMapper->Delete();
volume->Delete();
colorTransferFunction->Delete();
return 0;
}
--
Pang Shengyong
berry_hust at hotmail.com
Solidification Simulation Lab, Huazhong Univ. of Sci. & Tech.
(Tel)+86-27-87541922
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060329/5c4c5c21/attachment.htm>
More information about the vtkusers
mailing list