[vtkusers] Re: question on texture mapping

Bruce Lamond s9653742 at sms.ed.ac.uk
Wed Mar 16 07:14:33 EST 2005


Hi Ann,

do something like this:

get your .vtk model as vtkPoyData

vtkJPEGReader pic
        pic SetFileName "*.jpg"

vtkTexture tex
        tex SetInput [pic GetOutput]

vtkProjectedTexture pTex
        pTex SetInput [model GetOutput]
        pTex SetSRange 0 1
        pTex SetTRange 0 1
        pTex SetAspectRatio 0 0 0
        pTex SetFocalPoint 0 0 0
        pTex SetUp 0 1 0
        pTex SetPosition 0 0 0

(play around with the pTex settings to get the correct texture position)

vtkPolyDataMapper dMapper
        dMapper SetInput [pTex GetOutput]
vtkActor pTexActor
        pTexActor SetMapper dMapper
        pTexActor SetTexture tex

ren1 AddActor pTexActor
renWin Render


>Hi everyone,
>
>I'm using source file (.vtk) to generate a 3D shape which is
>non-standard, and I want to put up a texture in .jpg format on the
>shape.  I tried to used the vtkActor, but apparently it didn't work.
>So I wonder if anyone could possibily give some hint on it. Even some
>links or which class object I should use.
>
>Very much appreciated!
>
>
>Ann

--
=====================================================================
Bruce Lamond. Ph. D. student (www.brucelamond.net)
Institute of Perception, Action & Behaviour (www.ipab.inf.ed.ac.uk)
School of Informatics
JCMB
University of Edinburgh
The Kings Buildings
West Mains Road
Edinburgh EH9 3JZ
UK
Tel. (00 44 )/(0) 7791 773 019



More information about the vtkusers mailing list