[vtkusers] Can't view texture after mapping on .obj file

Judith Tony contactjudith at yahoo.co.in
Mon Nov 26 00:42:14 EST 2012


Dear all,

I've tried to texture map an .obj file using the PNG file.
But I could not see the texture after rendering.Here is my code:
*************************************************
from vtk import *
object = vtkOBJReader()
object.SetFileName('aa.obj')
objectMapper = vtkPolyDataMapper()
objectMapper.SetInputConnection(object.GetOutputPort())
objectActor=vtkActor()
objectActor.SetMapper(objectMapper)
# Read the image data from a file
pngreader = vtkPNGReader()
pngreader.SetFileName('aa.png')
pngreader.Update()
 
# Create texture object
texture = vtkTexture()
texture.SetInputConnection(pngreader.GetOutputPort())
texture.InterpolateOn()
objectActor.SetTexture(texture)
ren = vtkRenderer()
ren.AddActor(objectActor)
.
.
.
***********************************
How can I view the texture on the top of the .obj file.Pls throw light on this
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121126/60c13723/attachment.htm>


More information about the vtkusers mailing list