[vtkusers] Combined on-screen and off-screen possible with VTK-7.0.0 on linux/X?

Sophonet vtk12af6bc42 at kant.sophonet.de
Thu Jan 21 08:54:46 EST 2016


As one further follow-up of my two earlier e-mails, I have partly 
answered the question myself... remember, my question is related to the 
OpenGL (not OpenGL2) rendering backend.

Two observations:

1. It seems that the current CMake flag VTK_OPENGL_HAS_OSMESA is 
useless, since it does not set anything relevant (see my e-mail below)
2. It seems that combined on-screen / off-screen rendering is possible 
(on Mesa 9.2.3 using the OpenGL rendering backend):

    As a quick hack, I have changed VTKROOT/CMake/vtkOpenGL.cmake such 
that

    * VTK_USE_OSMESA = True (triggers find_package OSMesa)
    * VTK_USE_X = True (triggers find_package OpenGL)

    ...and (at the bottom) vtk_module_link_libraries links to *both*, 
${OSMESA_LIBRARY} and ${OPENGL_LIBRARIES}.

After this hack, I can successfully launch interactive 
(glx-)renderwindows as well as set (occasionally) set 
SetOffscreenRenderingOn().

Therefore, my suggestion would be to

- remove VTK_OPENGL_HAS_OSMESA
- change the vtkOpenGL.cmake such that VTK_USE_OSMESA is exposed as an 
advanced option and is not exclusive w.r.t. VTK_USE_X, but may be set at 
the same time.

Any comments?

Thanks,

        Sophonet


Am 2016-01-19 11:06, schrieb Sophonet:
> As a follow-up, I have done some more investigations myself and am 
> still lost:
> 
> According to http://www.vtk.org/Wiki/VTK/OSMesa_Support, it seems that
> the legacy OSMesa library on linux systems is not needed anymore, but
> that software renderers (such as gallium llvm) can provide off-screen
> rendering themselves. Correct?
> 
> When looking at VTKROOT/CMake/vtkOpenGL.cmake, it appears (not
> perfectly sure though) that in this case VTK_OPENGL_HAS_OSMESA needs
> to be turned on, since this flag sets VTK_CAN_DO_OFFSCREEN to 1.
> However, it seems to me that VTK_CAN_DO_OFFSCREEN is not used anywhere
> else (did a thorough "grep" on that keyword in the source tree).
> 
> It seems that Marcus (Hanwell) was responsible for many of these
> changes in CMake - Marcus, can you help?
> 
> What I would like to do is (see my first e-mail below) to
> simultaneously use interactive rendering and (occasionally) off-screen
> rendering (for generating static images), which was possible on Linux
> in earlier versions of VTK (e.g. 5.10), but is not possible anymore.
> 
> Thanks,
> 
>        Sophonet
> 
> 
> Am 2016-01-15 12:44, schrieb Sophonet:
>> Dear list,
>> 
>> in my application, I would like to display a vtkRenderWindow for user
>> interaction, but I also would like to use off-screen functionality
>> simultaneously to render pre-defined views / snapshots that are shown
>> as static images, like "thumbnails" for different datasets.
>> 
>> This was possible in VTK 5.10 on linux (by creating a dedicated
>> vtkRenderWindow per thumbnail, setting OffScreenRenderingOn, rendering
>> and capturing the resulting image with a vtkWindowToImageFilter).
>> 
>> In VTK-7.0.0.rc1, using the OpenGL rendering backend on Mesa 9.2.3, I
>> now get a segfault with the following backtrace:
>> 
>> (gdb) bt
>> #0  0x00007fffd045db90 in xcb_glx_get_string_string_length ()
>>    from /usr/lib64/libxcb-glx.so.0
>> #1  0x00007fffd0cce605 in ?? () from /usr/lib64/libGL.so.1
>> #2  0x00007fffd0ccc2b6 in ?? () from /usr/lib64/libGL.so.1
>> #3  0x00007fffd14cd086 in 
>> vtkOpenGLExtensionManager::ReadOpenGLExtensions() ()
>>    from
>> /import/QUINTA/non-public/software/linux-install/quinta_gcc_debug/lib/libvtkRenderingOpenGL-7.0.so.1
>> #4  0x00007fffd14cbd50 in vtkOpenGLExtensionManager::Update() ()
>>    from
>> /import/QUINTA/non-public/software/linux-install/quinta_gcc_debug/lib/libvtkRenderingOpenGL-7.0.so.1
>> #5  0x00007fffd14cafd7 in
>> vtkOpenGLExtensionManager::ExtensionSupported(char const*) ()
>>    from
>> /import/QUINTA/non-public/software/linux-install/quinta_gcc_debug/lib/libvtkRenderingOpenGL-7.0.so.1
>> #6  0x00007fffd14ec8ea in vtkOpenGLRenderWindow::OpenGLInitContext() 
>> ()
>>    from
>> /import/QUINTA/non-public/software/linux-install/quinta_gcc_debug/lib/libvtkRenderingOpenGL-7.0.so.1
>> #7  0x00007fffd14eae6d in vtkOpenGLRenderWindow::OpenGLInit() ()
>>    from
>> /import/QUINTA/non-public/software/linux-install/quinta_gcc_debug/lib/libvtkRenderingOpenGL-7.0.so.1
>> #8  0x00007fffd1576932 in
>> vtkXOpenGLRenderWindow::CreateOffScreenWindow(int, int) ()
>> 
>> Besides a remark that probably there could be better error handling
>> than just letting the app crash without an exception being thrown, I
>> would like to know if joint on-screen rendering and off-screen
>> rendering is still possible somehow with VTK-7.0.0.
>> 
>> I have made two approaches when configuring via CMake: (i) Setting
>> VTK_OPENGL_HAS_OSMESA=True (no effect, I think I remember that in
>> earlier versions, this allowed OSMESA_INCLUDE_DIR etc. to be set; this
>> is not the case anymore, so does this flag still do something? Note
>> that for VTK 5.10 as mentioned above I did not have to set this
>> explicitly), (ii) Setting USE_OFFSXCREEN_EGL=True - resulting in an
>> error that this could not be combined with VTK_USE_X.
>> 
>> On Windows, combining on-screen and off-screen rendering as described
>> in the second paragraph is possible.
>> 
>> Any suggestions would be welcome, the Wiki page I have found on this
>> topic is not fully understandable to me
>> (http://www.vtk.org/Wiki/VTK/OSMesa_Support; does this mean that I
>> have to switch on VTK_OPENGL_HAS_OSMESA or not?...)
>> 
>> Thanks,
>> 
>>       sophonet
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> 
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list