How to visualize a texture inside in sphere

Torlo, Marc torlo at uni-duisburg.de
Wed Jul 7 10:29:24 EDT 1999


Is it possible to render a texture inside a sphere (for example: to render a
sky) ? The following sample code will only render the image on the outside
surface. It worked with vtk2.2.
 
 vtkSphereSource *sphere = vtkSphereSource::New();

 vtkTextureMapToSphere *tmapper = vtkTextureMapToSphere::New();
 tmapper->SetInput(sphere->GetOutput());
 tmapper->PreventSeamOn();
 
 vtkTransformTextureCoords *xform = vtkTransformTextureCoords::New();
 xform->SetInput(tmapper->GetOutput());
 
 vtkDataSetMapper *mapper = vtkDataSetMapper::New();
 mapper->SetInput(xform->GetOutput());
 
 vtkTexture  *texture  = vtkTexture::New();
 
 vtkBMPReader *picReader = vtkBMPReader::New();
  picReader->SetFileName("something");
 
  texture->SetInput(picReader->GetOutput());
  texture->InterpolateOn();
 
  my_actor->SetMapper(mapper);
  my_actor->SetTexture(texture);
 
Thank You for your help. 


Gerhard-Mercator-Universitaet - Gesamthochschule Duisburg 
Fachbereich Maschinenbau - Fachgebiet Mechatronik 
Dipl.-Ing. Marc Torlo 
Lotharstr. 1 
D-47057 Duisburg 

phone ++49-203-379-1656 
fax   ++49-203-379-4143 
mail  mailto:torlo at uni-duisburg.de <mailto:torlo at uni-duisburg.de>  

 


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list