[vtkusers] release

seafloat at sohu.com seafloat at sohu.com
Mon Apr 19 06:46:34 EDT 2004


> Dear All:
>   When I compile a program with VC in debug mode. It can run well. But I try to compile in release mode, It give me many error. I use vtk4.0. Can anyone help me.
>    The program is :
> 
> #include "vtkConeSource.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkCamera.h"
> #include "vtkActor.h"
> #include "vtkRenderer.h"
> #include "vtkInteractorStyleTrackballCamera.h"
> #include "vtkAssembly.h"
> #include "vtkDataSetReader.h"
> #include "vtkTransformFilter.h"
> #include "vtkTransform.h"
> #include "vtkContourFilter.h"
> 
> int main( int argc, char *argv[] )
> {
>  	vtkDataSetReader *reader = vtkDataSetReader::New();
> 	reader->SetFileName("d:/vtkdata/data/ironprot.vtk");
> 	vtkPolyData * pp=(vtkPolyData*)reader->GetOutput();
> 
> 	vtkContourFilter *contour = vtkContourFilter::New();
> 	contour->SetInput(pp);
> 
>   vtkConeSource *cone = vtkConeSource::New();
>   cone->SetHeight( 3.0 );
>   cone->SetRadius( 1.0 );
>   cone->SetResolution( 10 );
>   
>    
>   vtkTransform *trans = vtkTransform::New();
>   trans->Identity();
> 
>   vtkTransformFilter *transfilter=vtkTransformFilter::New();
>   transfilter->SetInput(cone->GetOutput());
>   transfilter->SetTransform(trans);
> 
>   trans->RotateX(90);
> 
> 
>   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>   coneMapper->SetInput( cone->GetOutput() );
> 
>   vtkActor *coneActor = vtkActor::New();
>   coneActor->SetMapper( coneMapper );
>   coneActor->GetProperty()->SetColor(1,0,0);
> 
>   vtkActor *coneActor2= vtkActor::New();
>   coneActor2->SetMapper(coneMapper);
>   coneActor2->GetProperty()->SetColor(0,1,0);
>   coneActor2->RotateY(60);
> 
>   vtkAssembly *mycone= vtkAssembly::New();
>   mycone->AddPart(coneActor);
>   mycone->AddPart(coneActor2);
> 
>   vtkRenderer *ren1= vtkRenderer::New();
>   ren1->AddActor( mycone ); //coneActor
>   ren1->SetBackground( 0.1, 0.2, 0.4 );
> 
>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>   renWin->AddRenderer( ren1 );
>   renWin->SetSize( 300, 300 );
> 
>    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>   iren->SetRenderWindow(renWin);
> 
>    vtkInteractorStyleTrackballCamera *style = 
>     vtkInteractorStyleTrackballCamera::New();
>    iren->SetInteractorStyle(style);
> 
>   
>    renWin->Render();
>   iren->Start();
>   
>   
>   cone->Delete();
>   coneMapper->Delete();
>   coneActor->Delete();
>   ren1->Delete();
>   renWin->Delete();
>   iren->Delete();
>   style->Delete();
> 
>   return 0;
> }




More information about the vtkusers mailing list