Commit 587e17e0 authored by Taddeus Kroes's avatar Taddeus Kroes

Added experimentation file of OBJ reader in VTK.

parent f916a289
#!/usr/bin/env python
import vtk
def read_obj(filename):
reader = vtk.vtkOBJReader()
reader.SetFileName(filename)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(reader.GetOutput())
del reader
return mapper
def main():
# Create render window and interactor
ren = vtk.vtkRenderer()
win = vtk.vtkRenderWindow()
win.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(win)
# Read OBJ file
cubemapper = read_obj('cube.obj')
# Create actor
cubeactor = vtk.vtkActor()
cubeactor.SetMapper(cubemapper)
ren.AddActor(cubeactor)
iren.Initialize()
win.Render()
iren.Start()
if __name__ == '__main__':
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment