I had to setup an Openframeworks in a remote private server with GPU from Rapidswitch, and after struggling few hours I could make it work.
In order to have OpenGL you must have a X server running. Xvfb is not an option because it is not HW accelerated, so you will have to config your Xserver with no screen attached.
My system is Ubuntu 14.04.5 LTS
First, I checked that the GPU was present:
$ lspci | grep NVIDIA
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
Then, I've installed the nvidia drivers (I've chosen that version for no special reason, following a comment in a post).
$ sudo apt-get install nvidia-346 nvidia-settings
I run sudo nvidia-xconfig
and this is the top of my /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 352.93 (buildmeister@swio-display-x86-rhel47-07) Tue Apr 5 18:55:28 PDT 2016
Then, I modified /etc/X11/xorg.conf adding the AllowEmptyInitialConfiguration
option:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "AllowEmptyInitialConfiguration"
EndSection
Finally, I could start my X server on display :0
sudo /usr/bin/X :0
If everything was ok the command will launch the X server with HW acceleration. We can run glxinfo -display :0 | grep renderer
to check that it is indeed using the GPU. This was my output:
$ glxinfo -display :0 | grep renderer
OpenGL renderer string: GeForce GTX 750 Ti/PCIe/SSE2
Finally, you just export your display export DISPLAY=:0
and run any OPENGL code. You can check that it is working using the toy example glxgears
.
This is my output:
$ glxgears
Running synchronized to the vertical refresh.
The framerate should be approximately the same as the monitor refresh rate.
63388 frames in 5.0 seconds = 12677.544 FPS
63382 frames in 5.0 seconds = 12676.304 FPS
...
Now you're ready to run your OpenFrameworks projects. You don't need to make any change to the source code.