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

Andinet Enquobahrie andinet.enqu at kitware.com
Wed Oct 24 12:30:12 EDT 2007


Hi Vincent,

Couple of things you might want to look into-

1) Validity time of the transform that is set to the MeshObject.
2) View Camera parameters

-Andinet

On 10/24/07, Vincent Gratsac <vincent.gratsac at irisa.fr> wrote:
>
> 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/
> -----------------------------------------------------
>
> _______________________________________________
> IGSTK-Users mailing list
> IGSTK-Users at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20071024/4413d51c/attachment-0002.html>


More information about the IGSTK-Users mailing list