This article applies to NoMachine v. 6.2 or later and to servers for Linux supporting virtual desktops (e.g. NoMachine Workstation, Terminal Server etc ...) and Terminal Server Node.
For previous NoMachine versions, please refer to: https://www.nomachine.com/AR11K00737.
It's possible to configure NoMachine to use the VirtualGL libraries (included in the server and node packages) and therefore activate support for HW accelerated OpenGL applications. This allows OpenGL applications, namely 3D applications, to use server side graphics hardware (GPU) installed on the application server.
This configuration doesn't depend on the encoding method (e.g. HW or SW H.264 encoding) in use.
- the host machine is a physical computer and has a hardware-accelerated 3D video card
- Xorg is up and running to use the 3D video card
If the machine is headless (no monitor connected or the X server is not running),
please refer to the VirtualGL documentation for applying the appropriate
As first step, it's necessary to configure the X server on the system for giving VirtualGL access to the GPU. All users with a connection to the X server will be allowed to use the VirtualGL direct rendering.
'VirtualGL requires access to a GPU in the application server so that it can create off-screen pixel buffers (Pbuffers) and redirect the 3D rendering from X windows into these Pbuffers. Unfortunately, accessing a GPU on Linux and Unix systems requires going through an X server.' Ref. https://cdn.rawgit.com/VirtualGL/virtualgl/2.5.2/doc/index.html#hd006001
To configure the system for using VirtualGL, execute:
Note: to restore the system configuration and remove the configuration for VirtualGL support:
When the system is configured to use VirtualGL, you have two options:
a) Use VirtualGL for all applications, included the desktop.
b) Use VirtualGL only for specific application(s).
Option b), when possible, is preferable in order to avoid unforeseen incompatibilities between some applications and VirtualGL.
a) How to run all applications (included the desktop) under the provisioning of VirtualGL
In order to use VirtualGL in NoMachine virtual desktops/custom sessions and for all applications, execute from a terminal:
sudo /etc/NX/nxserver --virtualgl yes
(if you don't have sudo, run the command as root)
This command will set in /usr/NX/etc/node.cfg:
The system is now ready to run all applications in NoMachine virtual desktops or custom sessions under the provisioning of VirtualGL. This can be however redundant and could lead to unforeseen behaviors, since only those applications that use OpenGL will benefit from VirtualGL rendering.
To disable using VirtualGL:
sudo /etc/NX/nxserver --virtualgl no
This will set in /usr/NX/etc/node.cfg:
NOTE for GNOME desktops
Please see also 'A specific case' section below. It provides an alternative way to run GNOME with VirtualGL.
Enabling VirtualGL by setting 'EnableVirtualGLSupport 1' or running GNOME under the provision of VirtualGL are almost equivalent.
The difference is that by using the DefaultDesktopCommand key it's possible to specify some additional parameters in the command line, if needed. When GNOME is launched with vglrun, the environment is inherited by the applications.
Setting 'EnableVirtualGLSupport 1' should be suitable for almost all cases.
b) How to run only a specific application under the provisioning of VirtualGL
Launch the OpenGL application by running in a console inside the NoMachine virtual desktop:
/usr/NX/scripts/vgl/vglrun <opengl app>
TIP: You may also create a wrapper script to launch the application with the command above. Multiple OpenGL applications can be launched on the desktop by specifying the command for each of them.
If you need to run the OpenGL application in a NoMachine custom session, pre-pend:
to the command specified in the 'Run the following command' field of the client User's Interface.
A specific case
Solving slowness problems when running the GNOME desktop
If you are experiencing slowness when running the GNOME desktop, you may try to run GNOME under VirtualGL and use the accelerated graphics.
The example below is almost equivalent to set in /usr/NX/etc/node.cfg: EnableVirtualGLSupport 1.
Editing the DefaultDesktopCommand key as explained below allows to specify some additional options to the command line, if needed.
To run GNOME under VirtualGL, edit the /usr/NX/etc/node.cfg file, uncomment and add the command to run VirtualGL to the DefaultDesktopCommand key (and also to the CommandStartGnome key if you've 'desktop=1' in the ConnectPolicy key in the server configuration file).
For example, for RHEL-based Operating Systems:
DefaultDesktopCommand "/etc/gdm/Xsession 'env XDG_SESSION_TYPE=x11 /usr/NX/scripts/vgl/vglrun gnome-session --session=gnome'"
CommandStartGnome "/etc/gdm/Xsession 'env XDG_SESSION_TYPE=x11 /usr/NX/scripts/vgl/vglrun gnome-session --session=gnome'"
They may be slightly different on other systems. For example:
DefaultDesktopCommand "/etc/gdm/Xsession '/usr/NX/scripts/vgl/vglrun gnome-session --session=gnome' --disable-acceleration-check"
CommandStartGnome "/etc/gdm/Xsession '/usr/NX/scripts/vgl/vglrun gnome-session --session=gnome' --disable-acceleration-check"
For Debian 9:
DefaultDesktopCommand "env XDG_SESSION_TYPE=x11 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/NX/scripts/vgl/vglrun x-session-manager"
CommandStartGnome "env XDG_SESSION_TYPE=x11 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/NX/scripts/vgl/vglrun x-session-manager"
DefaultDesktopCommand "env XDG_SESSION_TYPE=x11 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=gnome"
CommandStartGnome "env XDG_SESSION_TYPE=x11 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=gnome"
When using this method, disable the VirtualGL support:
sudo /etc/NX/nxserver --virtualgl no
This will set in /usr/NX/etc/node.cfg:
A further example: run Firefox in custom session with hardware OpenGL acceleration
hardware OpenGL acceleration is enabled in Firefox
1) configure the system for using VirtualGL. Execute:
sudo /etc/NX/nxserver --virtualgl-install
2) Launch Firefox in a custom session by using this command:
/usr/NX/scripts/vgl/vglrun <path to Firefox>
How to check if VirtualGL is in use
Launch the NoMachine virtual desktop and open a terminal inside the session.
Run the following command in the terminal:
glxinfo | grep -i "renderer\|vendor"
The expected output is:
renderer: name of the Video Card
If the command returns:
renderer: Software Rasterizer
It means that VirtualGL is not in use.
In this case verify if the LD_PRELOAD environment variable is set, since VirtualGL is controlled by that variable.
Execute in the terminal:
env | grep LD_ PRELOAD
If this variable is empty or does not store VirtualGL libraries:
verify that EnableVirtualGL=1 is set in node.cfg, if you have followed instructions of a) How to run all applications under the provisioning of VirtualGL.
If instead you followed instructions for the specific case, 'Solving slowness problems when running the GNOME desktop', it's likely the Xsession script is cleaning up the environment variables. In this case verify the desktop command set in the DefaultDesktopCommand key in node.cfg.
The NoMachine server commands to enable VirtualGL support: https://www.nomachine.com/FR10N03215
More on OpenGL support: https://www.nomachine.com/AR01P00960
How VirtualGL works: https://www.nomachine.com/AR12K00764
Using VirtualGL to improve performance of GNOME 3 virtual desktops on RHEL 7/CentOS 7: https://www.nomachine.com/AR01Q01012
Using VirtualGL on headless machines, provided that you can configure the X server to run on the headless video card. See VirtualGL docs: