[vtkusers] Mesa not rendering scene, but works otherwise
Paul Cochrane
cochrane at esscc.uq.edu.au
Thu Mar 17 02:53:28 EST 2005
Hi all,
I've got a problem with Mesa not actually rendering a scene, whereas if I
don't use Mesa, and just render with the normal (i.e. the ones without Mesa
in the name) objects, then the scene displays correctly. The scene consists
of a warped image with the background set to a colour other than the
default. When rendered with Mesa I just get the background. What am I
doing wrong? (if anything). I'm using vtk version 4.2.1 (with Mesa enabled),
on Linux, and I'm using vtk from Python 2.3.4.
Any help would be greatly appreciated.
Regards,
Paul Cochrane
Here is the test code: (change mesa to True or False to switch Mesa on or
off respectively)
"""
Load an image, using either Mesa or OpenGL
"""
import vtk
mesa = True
imgReader = vtk.vtkTIFFReader()
imgReader.SetFileName("ausImage_lowres.tif")
imgReader.Update()
# now try and warp the data
luminance = vtk.vtkImageLuminance()
luminance.SetInput(imgReader.GetOutput())
geometry = vtk.vtkImageDataGeometryFilter()
geometry.SetInput(luminance.GetOutput())
warp = vtk.vtkWarpScalar()
warp.SetInput(geometry.GetOutput())
warp.SetScaleFactor(0.0)
# Use vtkMergeFilter to combine the original image with the warped
# geometry.
merge = vtk.vtkMergeFilter()
merge.SetGeometry(warp.GetOutput())
merge.SetScalars(imgReader.GetOutput())
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(merge.GetOutput())
mapper.SetScalarRange(0, 255)
mapper.ImmediateModeRenderingOff()
if mesa:
actor = vtk.vtkMesaActor()
else:
actor = vtk.vtkActor()
actor.SetMapper(mapper)
if mesa:
ren = vtk.vtkMesaRenderer()
renWin = vtk.vtkXMesaRenderWindow()
#renWin.OffScreenRenderingOn()
else:
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.OffScreenRenderingOn()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
renWin.AddRenderer(ren)
ren.AddActor(actor)
renWin.SetSize(640,480)
ren.SetBackground(0.1,0.2,0.4)
ren.ResetCameraClippingRange()
iren.Initialize()
renWin.Render()
iren.Start()
--
Paul Cochrane
Computational Scientist/Software Developer
Earth Systems Science Computational Centre
University of Queensland
Brisbane
Queensland 4072
Australia
E: cochrane at esscc.uq.edu.au
P: +61 7 3346 9797
F: +61 7 3365 7347
More information about the vtkusers
mailing list