I'm trying to get WebGL to work on my Amazon EC2 server (migrating from an office-bound Mac Mini, that has a lot of hiccups).
Worked some days to get this running, but I'll try to start from where i started.
First I installed the following AMI Ubuntu Server 12.04 LTS (HVM) - ami-8c8675fb
with instance type cg1.4xlarge
. I chose that instance type so it comes with a Cirrus Logic GD 5446
for graphical executions.
Of course the primary install is headless, so I had to build this server from scratch, what I did firstly is.
sudo apt-get install ubuntu-desktop
sudo apt-get install gdm
sudo /etc/init.d/gdm start
sudo dpkg-reconfigure xserver-xorg
sudo apt-get install gnome-core
After that I installed a LAMP server (the usual) and I updated the kernel to Linux ip-172-31-29-168 3.8.0-37-generic #53~precise1-Ubuntu SMP Wed Feb 19 21:37:54 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
.
I also registered the xorg edgers PPA at https://launchpad.net/~xorg-edgers/+archive/ppa.
After rebooting I had to connect a screen to my server, I chose to do this with vnc4server.
So that's the usual and my xstartup looks like this:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
After starting my VNC server and connecting it, I checked out my glfxinfo, so DISPLAY=:1 glxinfo
(Display :1 is the VNC)
The first output was:
name of display: :1
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
Error: couldn't find RGB GLX visual or fbconfig
Error: couldn't find RGB GLX visual or fbconfig
I fixed this one by installing the nvidia-current
package. I already knew for WebGL to run, I needed GLX version 1.3 at least. So I gave glxinfo
another swing and that gave the following output:
ubuntu@ip-172-31-29-168:~$ DISPLAY=:1 glxinfo | grep version
Xlib: extension "NV-GLX" missing on display ":1".
Xlib: extension "NV-GLX" missing on display ":1".
server glx version string: 1.2
client glx version string: 1.4
GLX version: 1.2
OpenGL core profile version string: 1.3 Mesa 4.0.4
OpenGL version string: 1.3 Mesa 4.0.4
As you can see the GLX version is not enough to run WebGL, I tried all the guides on this. None of them seem to raise the GLX version. You're probably asking, why WebGL, well I had this running on a Mac Mini server, which worked perfectly to create a nice 3D video. Not looking to edit the code, just looking to get it up in the Cloud. Also tried the windows server, but ran in a lot of issues with ffmpeg
there so that's also not an option. Now thinking of getting a Mac OS cloud server, but still wondering what's going wrong here.
So my question: is it even possible to do this on my Amazon EC2 server? And if so, how?
P.S. When I run chromium-browser from the command-line, this is my error:
ubuntu@ip-172-31-29-168:~/.vnc$ DISPLAY=:1 chromium-browser --enable-webgl
[12243:12243:0307/155523:ERROR:gl_surface_glx.cc(413)] GLX 1.3 or later is required.
[12243:12243:0307/155523:ERROR:gl_surface_x11.cc(58)] GLSurfaceGLX::InitializeOneOff failed.
Best Answer
Running OpenGL applications inside a virtual machine is very likely not going to perform well. First of all, you cannot use hardware acceleration but have to fall back to a software renderer. This is what the first error message tells you:
Installing the Nvidia driver does not help as there is no Nvidia card available - hence the second error message. Using a software renderer is possible, but it will be very slow.
So the answer is: Yes, it might be possible to do what you want but unless there is dedicated hardware that plays nicely with VNC on the virtual host this will not be a nice experience.