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.
NoMachine provides support for HW accelerated OpenGL applications in virtual desktop and custom sessions by using the VirtualGL library. This library is shipped in the NoMachine servers and node packages for Linux.
Pre-requisite is that the host machine is a physical computer and has a hardware-accelerated 3D card.
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.
b) Use VirtualGL only for specific application(s).
a) How to run all applications under the provisioning of VirtualGL
In order to use VirtualGL in NoMachine virtual desktops and custom sessions 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:
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.
To do that, edit the /usr/NX/etc/node.cfg file, uncomment and set the following keys:
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'"
Commands above apply to RHEL-based Operating Systems and 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"
When using this method, disable the VirtualGL support in the node.cfg file by setting:
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