[vtkusers] Re: Mesa 5.0.2 not drawing
Patrick Brockmann
Patrick.Brockmann at cea.fr
Wed Dec 10 09:21:02 EST 2003
Hi all,
Here is my experience on off-screen rendering using Mesa.
> I've been trying to get vtk4.2.2 to work with Mesa in order to enable
> off-screen rendering. I've found that code that will work just fine
> with OpenGL draws an empty screen under Mesa. Has anyone experienced
> this problem. To test the issue, i used the cylinder example from the
> examples/rendering directory and simply replaced the renderwindow and
> renderer with Mesa objects, see below.
>
> The original Cylinder code compiles and works perfectly. With Mesa,
> all i get is an empty RenderWindow.
>
> Has anyone seen this before?
Compile Mesa, then use the following options :
OPENGL_INCLUDE_DIR /home/user1/Mesa-5.0.1/include
OPENGL_gl_LIBRARY /home/user1/Mesa-5.0.1/lib/libGL.a
OPENGL_glu_LIBRARY /home/user1/Mesa-5.0.1/lib/libGLU.a
OPENGL_xmesa_INCLUDE_DIR /home/user1/Mesa-5.0.1/include
OSMESA_INCLUDE_DIR /home/user1/Mesa-5.0.1/include
OSMESA_LIBRARY /home/user1/Mesa-5.0.1/lib/libOSMesa.a
...
VTK_OPENGL_HAS_OSMESA ON
...
VTK_USE_MANGLED_MESA OFF
You can also specify GL2PS options to be able to use the
vtkGL2PSExporter class
GL2PS_INCLUDE_PATH /home/user1/gl2ps
GL2PS_LIBRARY /home/user1/gl2ps/libgl2ps.so
After this, just add to your code renWin.OffScreenRenderingOn() to run in a
offscreen mode (Default OpenGL has not this feature available).
Here is the python code:
****************************************
#!/usr/bin/env python
from vtkpython import *
renWin=vtkRenderWindow()
renWin.OffScreenRenderingOn()
ren=vtkRenderer()
renWin.AddRenderer(ren)
cone=vtkConeSource()
mp=vtkPolyDataMapper()
mp.SetInput(cone.GetOutput())
actor=vtkActor()
actor.SetMapper(mp)
ren.AddActor(actor)
renWin.Render()
w2if=vtkWindowToImageFilter()
w2if.SetInput(renWin)
wr=vtkPNGWriter()
wr.SetInput(w2if.GetOutput())
wr.SetFileName("OffScreenCone.png")
wr.Write()
psw = vtkGL2PSExporter()
psw.SetInput(renWin)
psw.SetFileFormat(0)
psw.SetFilePrefix("OffScreenCone")
psw.Write()
****************************************
- Patrick
--
mailto:Patrick.Brockmann at cea.fr
01.69.08.72.23 --> LSCE (Orme des merisiers 701, Bureau 50)
01.44.27.21.10 --> IPSL (Jussieu, Tour 26, 4eme)
http://www.ipsl.jussieu.fr/~brocksce/
More information about the vtkusers
mailing list