How can OpenGL graphics be displayed remotely using VNC?

Solution 1:

I'm using x11vnc to gain remote access to whatever the monitor is displaying. x11vnc talks to the local X11 server and copies the framebuffer from the server to the client via vnc. Since the local X11 server renders everything with hardware acceleration, I get hardware accelerated OpenGL over VNC, even with all the cool desktop effects. This is how I start x11vnc:

x11vnc -rfbauth ~/.vnc/passwd  -display :0 -forever -bg -repeat -nowf -o ~/.vnc/x11vnc.log

I think almost any vnc viewer works, but I'd recommend turbovnc or tigervnc. I tried VirtualGL first, and it works fine, but not for the whole desktop, only for individual OpenGL applications.

It is even possible to change resolution on the display/vnc using xrandr. E.g. like this:

xrandr -q (to see available modes and outputs)
xrandr --output DVI-I-0 --mode "1024x768" (change mode on DVI output)

(It is possible to add new resolutions if the available modes aren't enough, but that's outside the scope here.)

So now I have a fully OpenGL hardware accelerated and resizable VNC session.

Solution 2:

You may want to look at Virtual GL

Quote: "VirtualGL is an open source package which gives any Unix or Linux remote display software the ability to run OpenGL applications with full 3D hardware acceleration"

Solution 3:

Disable the special Video Hook driver that UltraVNC uses, or use TightVNC.

Since the UltraVNC driver is used to improve performance, it drops any kind of video processing done on the Video Card, such as OpenGL.

The video driver that UltraVNC installs this by default, it makes it so it cannot display OpenGL graphics. Note that disabling the driver will drastically decrease performance. Also note that while displaying items rendered in OpenGL performance will suffer on both ends, as the client machine now has a lot more work to do, and the bandwidth required is a lot higher. Don't expect anything over 4 seconds per frame (not 4 fps, more like 0.25 fps)