1

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

Joerg
  • 71
  • 4
  • Sounds like your MesaGL driver is returning inconsistent size information about the display. No idea how to fix that, other than making sure you have the latest update of both graphics card drivers and Mesa. – user2554330 Aug 08 '17 at 15:53

1 Answers1

0

After quiet a while and several kernel updates and mesa updates, I switched to the proprietary nvidia drivers and it worked. I would have preferred to stick to the untainted kernel, bur didn't find a better solution.

Joerg
  • 71
  • 4