[vtkusers] vtkTexture on vtkPolyData appears black

Mike Suttie m.suttie at ucl.ac.uk
Wed Jun 17 07:09:22 EDT 2009


 

 

Hi there I have recently ported over from vtk 4.0 using VS6 to vtk5.2 on
vs2008.

Issues have been plentiful but this one I can't seem to understand. 

 

I have code that generates a (vtkPolyData) surface which has a texture
applied to it from a generated vtkImageData object BUT the surface texture
appears completely black. As far as I can see both the image data and the
surface are generated with no issues and are exactly the same as in the
previous environment.

 

I have tested various things, if I add the surface to a vtkPLaneSource for
example this works fine and the surface appears which hints at a problem
with the vtkPolyData surface, but what!?

 

The code I'm using for this is :

 

vtkPolyData *surface = vtkPolyData::New();

            vtkImageData *im = vtkImageData::New();

                  

 
((vtkTexturedSurfaceModel*)this->pca)->GetParameterisedTexturedSurface(b,sur
face,im);

             

            vtkTexture *texture = vtkTexture::New();

            texture->SetInput(im);

            texture->InterpolateOn();  

            im->Delete();     

                  

            vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();

                  mapper->SetInput(surface);

 

            vtkActor *actor = vtkActor::New();

                  actor->SetTexture(texture);

            actor->SetMapper(mapper);

 

                  actor->GetProperty()->SetAmbient(1);

 

 

I can't see anything wrong with this code and it works perfectly in the
previous environment. Can anyone think of anything that I should look into
for this issue?????

 

Many thanks in advance.

 

 

Mike 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090617/be8988c1/attachment.htm>


More information about the vtkusers mailing list