[vtkusers] texturing a sphere

tom fogal tfogal at apollo.sr.unh.edu
Mon Aug 23 17:00:12 EDT 2004


Hi all, I'm trying to texture a sphere with a PNG image. I do this with
code similar to

PNGReader->SetFileName("file.png");
Texture->SetInput(PNGReader->GetOutput());
Texture->InterpolateOn(); //also tried w/o setting this
SphereSource->SetCenter(0,0,0);
SphereSource->SetRadius(1);
PolyDataMapper->SetInput(SphereSource->GetOutput());
Actor->SetMapper(PolyDataMapper);
Actor->SetTexture(Texture);

My sphere changes a deep blue when I enable the texture code, but I do
not see the actual texture on it. The actual image is small and of even
dimensions,

earth.png: PNG image data, 32 x 32, 16-bit/color RGB, non-interlaced

so I do not believe this to be a power-of-2 issue or problem loading a
texture that is beyond what my opengl implementation can do.

Perhaps most importantly, I tried running the 'TPlane.py' example and
got some disappointing output (in addition to no visible texture on the
plane):

ERROR: In /home/tfogal/tarballs/VTK/Rendering/vtkOpenGLTexture.cxx,
line 111
vtkOpenGLTexture (0x6640d0): No scalar values found for texture input!

Any ideas?

-tom



More information about the vtkusers mailing list