InitializeFromCurrentContext() not implemented for vtkEGLRenderWindow class
Background
Run VTK on a headless system (no X server) running Linux (Ubuntu 16.04).
An existing EGL context should be used by VTK.
Repro steps
Build VTK with EGL enabled: 'cmake -DVTK_OPENGL_HAS_EGL:BOOL=ON -D-DVTK_USE_X:BOOL=OFF VKTSource'.
Build the attached program VTKEGLCurrentContext.tar.gz, it creates a EGL context make it current and then create a vtkRenderWindow and calls InitializeFromCurrentContext on the render window.
It then checks if the EGL context is still current or VTK created a new one.
When running the program this is the output:
$ ./EGLCurrentContext
Initialized EGL (version 1.5)
FAILED: VTK is not using the provided context
Reason
Rendering/OpenGL2/vtkEGLRenderWindow.cxx does not implement InitializeFromCurrentContext().
I created a patch which implements InitializeFromCurrentContext() and fixes the problem, but my knowledge of the code base is limited so the patch is probably incomplete.
VTK_EGLInitilalizeFromCurrentContext.patch
When applying the patch the test program outputs
$ ./EGLCurrentContext
Initialized EGL (version 1.5)
PASSED: InitializeFromCurrentContext() worked