The solution is to define GLX_GLXEXT_LEGACY
during the build. This is done but commented in the file Rendering/vtkXOpenGLRenderWindow.cxx
for VTK 5.x or Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
for VTK 6.x.
Either uncomment the line (this is for example an ArchLinux patch for the package):
--- a/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx.orig 2014-11-23 22:16:50.000000000 +0100
+++ b/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx 2014-11-23 22:16:59.000000000 +0100
@@ -27,7 +27,7 @@
// define GLX_GLXEXT_LEGACY to prevent glx.h to include glxext.h provided by
// the system
-//#define GLX_GLXEXT_LEGACY
+#define GLX_GLXEXT_LEGACY
#include "GL/glx.h"
#include "vtkgl.h"
Or, if you don't want to be invasive on the source code, you can add the flags to the compiler command line. For example by adding -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY
to your cmake command line. Your cmake command will look like:
cmake -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY -Wno-dev ../VTK