Cleanup offscreen rendering support in VTK.

This commit cleans up offscreen (rather headless) rendering support in VTK. This includes several changes.

  1. It makes EGL support independent of onscreen GL support. It's now possible to enable EGL and GLX in same build of VTK, for example, so long as the two use shared GL-dispatch mechanism. Previously, EGL could not be enabled together with GLX (i.e. VTK_USE_X set to ON). These changes allow for that configuration.

  2. VTK_USE_OFFSCREEN_EGL is replaced by VTK_OPENGL_HAS_EGL. This is consistent with VTK_OPENGL_HAS_OSMESA flag. And also in similar vein to upcoming changes to FindOpenGL.cmake where EGL becomes a component of find_package(OpenGL).

  3. VTK_EGL_DEVICE_INDEX has been replaced by VTK_DEFAULT_EGL_DEVICE_INDEX since it only affect the default value, and doesn't preclude users from manually specifying the device index.

  4. VTK_USE_OFFSCREEN has been replaced by VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN, since similar to 3 this option was only intended to affect the default value. This only changes the default value for vtkRenderWindow::OffscreenRendering flag. It has no impact on which type of render window is created, for example.

  5. VTK_DEFAULT_RENDER_WINDOW_HEADLESS is a new option that can be turned on when VTK is compiled with headless and onscreen rendering support. Turning this ON (OFF by default) will make the object factory instantiate the headless render window subclasss when vtkRenderWindow::New is called.

  6. Simplified FindEGL.cmake. Apps don't need to link against gldispatch library and hence removed it and created an imported target to simplify use.

  7. For all changes to CMake variables, we put out DEPRECATION messages if old variables are used.

  8. When VTK_USE_X and VTK_OPENGL_HAS_EGL or VTK_OPENGL_HAS_OSMESA in ON, following things happen:

    1. The object-factory simply returns the X-based (or onscreen) render window i.e. vtkXOpenGLRenderWindow.
    2. To create one of the offscreen render windows, one can manually instantiate them e.g. by explicitly instantiating vtkEGLRenderWindow. vtkXOpenGLRenderWindow has implementation to swap to OSMesa if SetUseOffscreen(true) is called.
    3. As soon any off-screen features are enabled, glew uses the offscreen library APIs to get OpenGL function pointers irrespective of how the active context was initialized.
  9. Removed all OSMesa code from vtkXOpenGLRenderWindow. If headless OSMesa offscreen is intended, applications should create vtkOSOpenGLRenderWindow (or vtkEGLRenderWindow), and not vtkXOpenGLRenderWindow.

Edited by Utkarsh Ayachit

Merge request reports

Loading