[vtkusers] textures and vtkPolyData (missing scalars?)

Wiebke Timm wiebke.timm at uni-bielefeld.de
Thu Mar 4 10:30:30 EST 2004


Hi!

I'm trying to apply a texture to a vtkPolyData object that consists 
only of
points and triangle strips. I don't have any scalar data that could be
applied to it or used with it.
When I try to apply a texture, during runtime I get the following error:

ERROR: In /debian/stage/vtk-4.2.5/Rendering/vtkOpenGLTexture.cxx, line 
111
vtkOpenGLTexture (0x80bfef0): No scalar values found for texture input!


The part of my program that applies the texture looks like this:
(Declarations are in the header file, so this compiles without a flaw.)
(vtkMyActor is just an extended vtkActor class.)

       ptexmap = vtkTextureMapToPlane::New();
       ptexmap->SetInput(this->GetData());

       pTransform = vtkTransformTextureCoords::New();
       pTransform->SetInput(ptexmap->GetOutput());
       pTransform->SetScale(3,3,1);

       bmpread = vtkBMPReader::New();
       bmpread->SetFileName("$FISH/../img/masonry.bmp");

       texture = vtkTexture::New();
       texture->SetInput(bmpread->GetOutput());
       texture->InterpolateOn();

       pmap->SetInput( (vtkPolyData*) (pTransform->GetOutput()) );

       this->fishact = vtkMyActor::New();
       fishact->SetMapper(pmap);
       fishact->SetTexture(texture);


I'm wondering if it's the cast to (vtkPolyData*) that confuses the 
texture
mapping because a collegue said the same code (except for variable 
names)
works for him - but without that cast. When I try to compile without 
that
cast, I get the error:

g++ -c -pipe -w -O2  -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT 
-I/usr/share/qt3/mk
Fish.cc: In member function VtkMyActor* Fish::GetActor()':
Fish.cc:252: error: invalid conversion from VtkDataSet*' to 
VtkPolyData*'
Fish.cc:252: error:   initializing argument 1 of Void 
vtkPolyDataMapper::SetInput(vtkP
make: *** [Fish.o] Error 1


Any ideas on that? I would be really thankful...

Ciao!
    Wiebke




More information about the vtkusers mailing list