[vtkusers] Problem with loading a texture

Lam Ha Hoang kei at gmx.ch
Fri Dec 14 08:26:56 EST 2007


Hello everyone

I am trying to load e texture over a stl-file with the following code:

vtkSTLReader *sr = vtkSTLReader::New();
	sr->SetFileName("skull.stl");

	// create the texture
	//
	vtkJPEGReader *myJPEG = vtkJPEGReader::New();
	myJPEG->SetFileName("blood.jpg");
	vtkTexture *texture = vtkTexture::New();
	texture->SetInput(myJPEG->GetOutput());
	texture->InterpolateOn();

	vtkTextureMapToPlane *myPlane = vtkTextureMapToPlane::New();
	myPlane->SetInput(myJPEG->GetOutput());
	myPlane->AutomaticPlaneGenerationOn();

	vtkPolyDataMapper *stlMapper = vtkPolyDataMapper::New();
	stlMapper->SetInputConnection(sr->GetOutputPort());

	vtkLODActor *stlActor = vtkLODActor::New();
	stlActor->SetMapper(stlMapper);

Now i get 2 errors: each time where I use the GetOutput()-function. I know that it is a type-cast-issue and I've already tried the GetOutputDataObject()-function, but for ths case I need a port, which I don't have.

What is the easiest solution? Do I need to generate e port? Any help would be appreciated very much. Samples/Examples would be nice.

Thanks in advance
Lam
-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail



More information about the vtkusers mailing list