On my computer at work my rgl snapshots only contain the upper left corner of the displayed GL device. For python using mayavi using the onscreen snapshot works. However, using offscreen rendering results in the same mistake. Sadly my problem is not reproducible, since at home using the same script works as it should. Therefore, I guess it must be related to mesa, but I don't have a clue, where to search for my misconfiguration. Both computers operate under Debian testing, but I experience that problem already for a while. I found a comment in another thread about the same problem, but no solution was provided.
Here is the R code I ran:
library(rgl)
shade3d(cylinder3d(matrix(c(1, -1, 2, -2, 0, 5), 2)), color="red")
rgl.viewpoint(0, -55, fov=30, zoom=0.6)
rgl.snapshot("rgl2.png")
Resulting in rgl.snapshot, but should be rgl screenshot
The python code I used is
from mayavi import mlab
kwargs = dict(color=(.0,.33,.0), mode='cone', resolution=20, scale_mode='none', scale_factor=0.12, opacity=0.67)
cone = mlab.quiver3d(0, 0, 0, -1.0, 0.0, -1.0, **kwargs)
mlab.savefig('mayavi.png')
mlab.close()
from tvtk.api import tvtk
from tvtk.common import configure_input_data
mlab.options.offscreen = True
fig=mlab.figure()
kwargs = dict(color=(.0,.33,.0), mode='cone', resolution=20, scale_mode='none', scale_factor=0.12, opacity=0.67)
cone = mlab.quiver3d(0, 0, 0, -1.0, 0.0, -1.0, **kwargs)
rw = tvtk.RenderWindow(size=fig.scene._renwin.size, off_screen_rendering=1)
rw.add_renderer(fig.scene._renderer)
w2if = tvtk.WindowToImageFilter()
w2if.magnification = fig.scene.magnification
w2if.input = rw
ex = tvtk.PNGWriter()
fname = 'mayavi_offscreen.png'
ex.file_name = fname
configure_input_data(ex, w2if.output)
w2if.update()
ex.write()
The results are equivalent. The first (mlab.savefig) works as it should, but the second (ex.write) results in the upper left corner only as in the above R example.
Did anyone experience the same problem and solved it? Any suggestions? Any more information needed (p.e.glxinfo, ...)?
Thanks and kind regards
Jörg