title: vtkXOpenGLRenderWindow error in a terminal in VNC
body: <p>I run a vnc server on my workstation and connect with another computer. Both of the server and client are running Debian Jessie:</p>
  
  <pre><code>$ uname -a
  Linux debian-VAIO 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u2 (2016-06-25) x86_64 GNU/Linux
  </code></pre>
  
  <p>Xfce is installed for the vnc server and <code>xstartup</code> is:</p>
  
  <pre><code>$ cat ~/.vnc/xstartup
  #!/bin/sh
  xrdb $HOME/.Xresources
  xsetroot -solid grey
  export XKL_XMODMAP_DISABLE=1
  exec startxfce4
  </code></pre>
  
  <p>In the ~/.bashrc, I have added the lines below:</p>
  
  <pre><code>export LIBGL_ALWAYS_INDIRECT=y
  export LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libstdc++.so.6'
  </code></pre>
  
  <p>Currently, when I ssh to the server with <code>ssh -X</code>, the <code>$DISPLAY</code> is <code>localhost:10.0</code>, and the vtk related command will launch an X window. However, if a vnc server is launched in the ssh terminal, logging into xfce and opening a terminal in it, the <code>$DISPLAY</code> is <code>:1.0</code> and vtk fails to launch an X window, with the following message:</p>
  
  <pre><code>Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
  vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
  
  Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
  vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
  
  Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
  vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
  
  Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 613
  vtkXOpenGLRenderWindow (0x2c30f10): GLX not found.  Aborting.
  </code></pre>
  
  <p>I think it might be relate to the missed config of X server in <code>xstartup</code> of vnc server. But I don't know how to do it. Could anyone help me debug it? Any further information will be provided if needed. Thanks!</p>
  
  <p><strong>20160823 Update</strong></p>
  
  <p>I accepted the suggestion of VirtualGL + TurboVNC and installed the two components. A simple config using <code>vglserver_config</code> was done according to <a href="http://www.virtualgl.org/vgldoc/2_1_1/#hd009001" rel="nofollow">http://www.virtualgl.org/vgldoc/2_1_1/#hd009001</a> part 6.1. Then I made <code>vncserver</code> of TurboVNC to run xfce with <code>xstartup.turbovnc</code>:</p>
  
  <pre><code>#!/bin/sh
  unset SESSION_MANAGER
  unset DBUS_SESSION_BUS_ADDRESS
  OS=`uname -s`
  exec startxfce4
  </code></pre>
  
  <p>On the client, I use <code>vncviewer</code> of TurboVNC to connect the server. The desktop looks quite different from that in a default vncserver. Then I tried </p>
  
  <pre><code>/opt/VirtualGL/bin/vglrun vmtkimageviewer -ifile image_volume_voi.vti
  </code></pre>
  
  <p>in which the vmtkimageviewer should open up a window, but finally it gives out an error:</p>
  
  <pre><code>Executing vmtkimageviewer ...
  X Error of failed request:  GLXBadContext
    Major opcode of failed request:  156 (GLX)
    Minor opcode of failed request:  6 (X_GLXIsDirect)
    Serial number of failed request:  17
    Current serial number in output stream:  16
  </code></pre>
  
  <p>And unfortunately, I find that with <code>ssh -X</code>, I cannot launch the X window as I did before, although <code>$DISPLAY</code> is still <code>localhost:10.0</code>. The output is:</p>
  
  <pre><code>Executing vmtkimageviewer ...
  X Error of failed request:  BadValue (integer parameter out of range for operation)
    Major opcode of failed request:  156 (GLX)
    Minor opcode of failed request:  3 (X_GLXCreateContext)
    Value in failed request:  0x0
    Serial number of failed request:  37
    Current serial number in output stream:  38
  </code></pre>
  
  <p>But I think I am closer to the fact, as it looks like VirtualGL works(?). What to do for the next?</p>