OpenGL

From
Wikipedia:OpenGL
:
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.
Learn more at
Khronos
.
Development of OpenGL ceased in 2017 in favour of
Vulkan
, the "next generation" API which offers higher performance on newer hardware.
Installation
To run applications that use OpenGL, you will need to
install
the correct driver(s) for your hardware (either GPUs or CPUs).
Tip
For AMD (and ATI) it is recommended to use the open-source drivers unless you have a strong reason to use the proprietary ones.
For NVIDIA, the proprietary driver is recommended for cards newer than the
Kepler (NVE0/GK
XXX
)
series, and for better performance in general.
Note
Intel's Gen
N
hardware does not refer to the generation of the CPU, it refers to the
generation of the GPU
, which is different from the generation of the CPU.
To find the family of an AMD (and ATI) GPU, check
Wikipedia:List of AMD graphics processing units#Features overview
To find the code-name of an NVIDIA GPU, check the
code-name list from the Nouveau project
Mesa
is an open-source OpenGL implementation, continually updated to support the latest OpenGL specification. It has a collection of open-source drivers for
Intel graphics
,
AMD
(formerly
ATI
) and
NVIDIA
GPUs. Mesa also provides software
rasterizers
, such as llvmpipe.
There are two Mesa packages, each with a distinct set of drivers:
mesa
is the up-to-date Mesa package which includes most of the modern drivers for newer hardware:
r300
: for AMD's Radeon R300, R400, and R500 GPUs.
r600
: for AMD's Radeon R600 GPUs up to Northern Islands. Officially supported by AMD.
radeonsi
: for AMD's Southern Island GPUs and later. Officially supported by AMD.
nouveau
:
Nouveau
is the open-source driver for NVIDIA GPUs.
virtio_gpu
: a virtual GPU driver for virtio, can be used with
QEMU
based VMMs (like
KVM
or
Xen
).
vmwgfx
: for
VMware
virtual GPUs.
i915
: for Intel's Gen 3 hardware.
crocus
: for Intel's Gen 4 to Gen 7 hardware.
iris
: for Intel's Gen 8 hardware and later. Officially supported by Intel.
zink
: a Gallium driver used to run OpenGL on top of
Vulkan
.
d3d12
: for OpenGL 3.3 support on devices that only support D3D12 (i.e.
WSL
).
softpipe
: a software rasterizer and a reference Gallium driver.
llvmpipe
: a software rasterizer which uses LLVM for x86 JIT code generation and is multi-threaded.
mesa-amber
is the legacy Mesa package which includes the classic (non-Gallium3D) drivers for older hardware:
i830
: for Intel's Gen 2 hardware. Same binary as
i965
.
i915
: for Intel's Gen 3 hardware. Same binary as
i965
.
i965
: for Intel's Gen 4 to Gen 11 hardware. Officially supported by Intel.
radeon
: for AMD's Radeon R100 GPUs. Same binary as
r200
.
r200
: for AMD's Radeon R200 GPUs.
nouveau_vieux
: for NVIDIA NV04 (Fahrenheit) to NV20 (Kelvin) GPUs.
swrast
: a legacy software rasterizer.
Note
When using Mesa, the correct driver should be selected automatically, thus no configuration is needed once the package is installed.
nvidia-utils
is the proprietary driver for
NVIDIA
GPUs, which includes an OpenGL implementation.
Verification
To verify your OpenGL installation, you can use
mesa-utils
eglinfo
, which should display output like this (with different values depending on your setup, of course):
$ eglinfo -B
Wayland platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: Intel
OpenGL core profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL core profile version: 4.6 (Core Profile) Mesa 25.1.3-arch1.3
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: Intel
OpenGL compatibility profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 25.1.3-arch1.3
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: Intel
OpenGL ES profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 25.1.3-arch1.3
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

X11 platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: Intel
OpenGL core profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL core profile version: 4.6 (Core Profile) Mesa 25.1.3-arch1.3
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: Intel
OpenGL compatibility profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 25.1.3-arch1.3
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: Intel
OpenGL ES profile renderer: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 25.1.3-arch1.3
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20
On X11 platform,
glxinfo
works as well.
From the same package, you can also use
eglgears_x11
or
glxgears
(on X11) or
eglgears_wayland
(on Wayland) as a basic OpenGL test. You should see 3 rotating gears when running the program.
Switching between drivers
For
Hybrid graphics
, see
PRIME
.
Note
According to this
Reddit post
, you can use 2 GPUs from different vendors working at the same time using
PRIME
without any problems.
Mesa
You can override the driver used for an application with the following
environment variable
:
MESA_LOADER_DRIVER_OVERRIDE=
driver
By default, Mesa searches for drivers in
/lib/dri/
. You can view the list of installed drivers with
$ ls /lib/dri/
driver
in
driver
_dri.so
is the actual name of the driver. If Mesa failed to find the specified driver, it will fall back to
llvmpipe
.
You can also use an OpenGL software rasterizer by setting the following
environment variables
:
LIBGL_ALWAYS_SOFTWARE=true
GALLIUM_DRIVER=
driver
driver
can be either
softpipe
,
llvmpipe
, or
swr
.
Tip
In most use-cases,
llvmpipe
and
swr
are faster than
softpipe
.
OpenGL over Vulkan (Zink)
From the
Mesa documentation
:
The Zink driver is a Gallium driver that emits Vulkan API calls instead of targeting a specific GPU architecture. This can be used to get full desktop OpenGL support on devices that only support Vulkan.
If you are experiencing issues in your default OpenGL drivers (a bug in RadeonSI, Iris, etc.), you could try using the Zink driver.
According to
this Phoronix benchmark
, the average FPS might be lower in some applications compared to RadeonSI.
Note that Zink no longer works out-of-the-box on X systems that use the AMD or Intel DDX drivers (
xf86-video-amdgpu
and
xf86-video-intel
, respectively). Upstream developers recommend use of the generic
modesetting(4)
DDX driver
.
[1]
Alternatively, to bypass this issue, you can use the following environment variables:
$ LIBGL_KOPPER_DRI2=1 MESA_LOADER_DRIVER_OVERRIDE=zink
To use Zink on the proprietary NVIDIA driver, use this command or similar:
$ env __GLX_VENDOR_LIBRARY_NAME=mesa __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink LIBGL_KOPPER_DRI2=1
application
Troubleshooting
Lenovo GPU Graphics Mesa Error
Mesa was using CPU (llvmpipe) for rendering, which crashed some GUI software. Fixed this by going to BIOS settings and choosing Dynamic Graphics over Discrete Graphics (If using another computer, choose the option that lets you switch between GPUs than disabling the integrated GPU). This will happen if main GPU driver is not installed but you expect the integrated one to work.
[2]