[vtkusers] Problem With texture mapping

vinay l. vinay.l at iiitb.ac.in
Fri Feb 27 04:25:38 EST 2009


Hi all,

I am trying to map an image on to a cylinder. This is the code i have written in tcl.

package require vtk

vtkCylinderSource cyl
cyl SetResolution 30
cyl SetRadius 6
cyl SetHeight 15
cyl CappingOn
cyl SetCenter 0 0 0

vtkDataSetMapper mapper
mapper SetInputConnection [cyl GetOutputPort]


vtkJPEGReader jpgReader
jpgReader SetFileName "C:\\Data\\image.jpg"
vtkTexture atext
atext SetInputConnection [jpgReader GetOutputPort]
atext InterpolateOn
vtkActor triangulation
triangulation SetMapper mapper
triangulation SetTexture atext

vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

ren1 AddActor triangulation
ren1 SetBackground 1 1 1
renWin SetSize 640 240
renWin Render

renWin Render
wm withdraw .

The problem is that the image is being mapped on the cylinder twice, One being the mirror image of the other.
If there is some word printed on the image then in the cylinder, the word is being printed normally and apart from that there
is a mirror image of the word too. The original image is being mapped onto half the cylinder with the mirror image being mapped
on the other half.

I want just 1 image to be fully mapped on to the cylinder. Can someone please help.

Thanks in advance,

Vinay L




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


More information about the vtkusers mailing list