[vtkusers] Textures on polydata.
Thomas Sundgaard Pedersen
sundgaard at inropa.com
Mon Feb 7 07:49:29 EST 2005
Hi,
I am new to visualization, and was trying to add textures to some
stl-files, that I imported. It worked fine with a vtkPlaneSource as
input to the vtkPolyDataMapper, but didn't work with vtkSTLReader as
input. The actor is showen in the vtk window and represents the stl-file
as it should, but if I set the texture, I only get the whole actor
colored in the color of the bmp's first pixel, it seems?
This code shows how I implemented it:
vtkWin32OpenGLRenderWindow *renWin =
vtkWin32OpenGLRenderWindow::New();
vtkRenderer *ren = vtkRenderer::New();
vtkSTLReader *STLReader = vtkSTLReader::New();
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
vtkActor *actor = vtkActor::New();
vtkBMPReader* bmpReader = vtkBMPReader::New();
vtkTexture* atext = vtkTexture::New();
renWin->AddRenderer(ren);
STLReader->SetFileName("..\\parts\\bumper.stl");
mapper->SetInput(this->m_pSTLReader->GetOutput());
actor->SetMapper(this->m_pMapper);
ren->AddActor(actor);
bmpReader->SetFileName("..\\res\\rawmetal_160x160.bmp"); //
160 x 160 pixles.
atext->SetInput(bmpReader->GetOutput());
atext->InterpolateOn();
actor->SetTexture(atext); //Works fine with vtkPlaneSource, but not with
vtkSTLReader?
renWin->render();
If I want to use textures on stl-files what do I do, or isn't it
possible at all?
greets
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050207/2966e297/attachment.htm>
More information about the vtkusers
mailing list