offscreen rendering outputs black image unless new renderwindow created
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 316
- Avg merge
- 7h 44m
- Merged PRs (30d)
- 5
Description
This occurs on OSX 10.9.5 (AMD 6750M graphics card) with mayavi 4.4.2.
A simple test of off screen rendering and image saving, such as:
```
from mayavi import mlab
mlab.options.offscreen = True
mlab.test_contour3d()
fig = mlab.gcf()
mlab.savefig(figure=fig, filename='example.png')
```
gives a blank output (i.e. a black image).
However, if a new render window is created and then the figure's renderer is added to this render window, for example (based on tvtk offscreen example code, could undoubtedly be cleaned up):
```
from mayavi import mlab
from tvtk.api import tvtk
from tvtk.common import configure_input_data
mlab.options.offscreen = True
mlab.test_contour3d()
fig = mlab.gcf()
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()
ex.file_name = 'example4.png'
configure_input_data(ex, w2if.output)
w2if.update()
ex.write()
```
the image output is correct.
From a brief inspection it's not clear as to how the new render window differs from the one that is automatically generated.
Regardless of whether the image is saved correctly, the rendering seems to be much slower when `mlab.options.offscreen = True` than when `mlab.options.offscreen = False`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.