[IGSTK-Users] Can't apply texture to a surface

Vincent Gratsac vincent.gratsac at irisa.fr
Wed Oct 24 10:29:16 EDT 2007


Hi igstk-users,

I'm currently trying to apply a texture on a surface.
So I developed a new class called TexturedMeshObjectRepresentation which
inherits MeshObjectRepresentation.
This class does the same thing than its super class, but I added this
code at the end of the CreateActors method :

>   if( m_TextureFileNameIsSet )
>     {
>       vtkPNMReader *pnmReader = vtkPNMReader::New();
>       pnmReader->SetFileName(m_TextureFileName.c_str());
>
>       if(!  pnmReader->CanReadFile(m_TextureFileName.c_str()))
>     {
>       igstkLogMacro( CRITICAL,"Unable to read texture file\n" );
>       return ;
>     }
>         
>       vtkTexture* texture = vtkTexture::New();
>       texture->SetInput( pnmReader->GetOutput() );
>       texture->InterpolateOn();
>  
>       meshActor->SetTexture(texture);
>     }
>  
>   this->AddActor( meshActor );

where m_TextureFileName contains the name of the corresponding PNM file.

The resulting surface representation is black.
I tried to write a simple VTK executable in order to test this code, and
it works correctly...

So does anyone know where can be the problem ?

Thank you and have a nice day !

-- 
Vincent Gratsac
----------------------------------------------------
Unité/Projet VisAGeS U746
INSERM/INRIA/CNRS/U. de Rennes I
IRISA
Campus de Beaulieu, 35042 Rennes Cedex, France

Ph:  +33 (0) 2 23 23 49 20/ Fax: +33/0 2 99 84 71 71
email: Vincent.Gratsac at irisa.fr
http://www.irisa.fr/visages/
-----------------------------------------------------




More information about the IGSTK-Users mailing list