[vtkusers] Sphere example

Amy Henderson amy.henderson at kitware.com
Mon May 10 08:35:16 EDT 2004


You need to add vtkProperty.h to your list of include files in this example.

- Amy

At 08:10 PM 5/9/2004, Ipaq hp wrote:
>Hi again, when i try to compile the first example that is in 
>http://www.vtk.org/example-code.php,the one with the sphere (i just did a 
>copy/paste), it gives me this errors:
>
>G:\Archivos de programa\Microsoft Visual 
>Studio\MyProjects\VTKprojects\ejemplo1vtk.cpp(24) : error C2027: use of 
>undefined type 'vtkProperty'
>        g:\documents and 
> settings\administrador\escritorio\vtk\include\vtk\vtkactor.h(42) : see 
> declaration of 'vtkProperty'
>G:\Archivos de programa\Microsoft Visual 
>Studio\MyProjects\VTKprojects\ejemplo1vtk.cpp(24) : error C2227: left of 
>'->SetColor' must point to class/struct/union
>Error executing cl.exe.
>
>Sphere example:
>
>#include "vtkSphereSource.h"
>#include "vtkPolyDataMapper.h"
>#include "vtkActor.h"
>#include "vtkRenderWindow.h"
>#include "vtkRenderer.h"
>#include "vtkRenderWindowInteractor.h"
>
>void main ()
>{
>
>  // create sphere geometry
>  vtkSphereSource *sphere = vtkSphereSource::New();
>  sphere->SetRadius(1.0);
>  sphere->SetThetaResolution(18);
>  sphere->SetPhiResolution(18);
>
>  // map to graphics library
>  vtkPolyDataMapper *map = vtkPolyDataMapper::New();
>  map->SetInput(sphere->GetOutput());
>
>  // actor coordinates geometry, properties, transformation
>  vtkActor *aSphere = vtkActor::New();
>  aSphere->SetMapper(map);
>  aSphere->GetProperty()->SetColor(0,0,1); // ****Problem line*******
>
>  // a renderer and render window
>  vtkRenderer *ren1 = vtkRenderer::New();
>  vtkRenderWindow *renWin = vtkRenderWindow::New();
>  renWin->AddRenderer(ren1);
>
>  // an interactor
>  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>  iren->SetRenderWindow(renWin);
>
>  // add the actor to the scene
>  ren1->AddActor(aSphere);
>  ren1->SetBackground(1,1,1); // Background color white
>
>  // render an image (lights and cameras are created automatically)
>  renWin->Render();
>
>  // begin mouse interaction
>  iren->Start();
>}
>
>
>But when i compile the other example,(the cuadratic function that is in 
>http://www.vtk.org/example-code.php, the second example) , doesnt give me 
>any error, and it seems to me, that it does the same procedure to draw a 
>cube, i dont see the difference between the lines where they set the color 
>to de actors.
>
>
>Thanks.
>
>_________________________________________________________________
>Reserva desde ahora tus vacaciones en MSN Viajes. Más cómodo, más barato y 
>más opciones. http://www.msn.es/Viajes/
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic. 
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list