142

I want to find out the OpenGL version I'm using. I have access to Ubuntu via SSH. Which command shall I execute?

8 Answers 8

169

To Check OpenGL Version,

glxinfo | grep "OpenGL version"

You will get the output as follows,

glxinfo | grep "OpenGL version"
OpenGL version string: 1.4 (2.1 Mesa 7.7.1)

Edit:

You may have better luck with modern OpenGL just grepping for "version" instead of "OpenGL version" given the differences between the core and compat profiles, as well as the various GLSL and GLES versions:

glxinfo | grep 'version'
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.1
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.1.2
OpenGL core profile shading language version string: 4.10
OpenGL version string: 3.0 Mesa 11.1.2
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Notice that the actual version is presented by the "core profile version" (4.1), whereas the "OpenGL version" is presented as 3.0.

7
  • 7
    Careful! glxinfo is telling you the version of OpenGL used by your DISPLAY, not the remote machine! However, it will tell you the GLX version of the remote machine (the "client" bits).
    – Rich
    Apr 3, 2015 at 0:12
  • And if you're getting the right card but wrong OpenGL version, it's probably the nouveau / open source drivers -- either blacklist them or uninstall them.
    – Engineer
    Apr 13, 2015 at 12:00
  • 1
    I've made some edits so that better information can be found with modern OpenGL versions that present multiple profiles, especially given that this is the top result on a google search for "Linux check opengl version".
    – Taywee
    Feb 20, 2016 at 23:31
  • 6
    Note: In Ubuntu 16.04, glxinfo is not available by default. To be able to use it, you need to install mesa-utils package.
    – starleaf1
    Jul 31, 2017 at 4:55
  • 1
    @frank Look at the answer below, by thomasmichaelwallace in the Development Libraries section. When you run an openGL client on a remote machine, the remote client uses the remote libraries, but displays onto your server, so it's a bit confusing at times
    – Rich
    Sep 3, 2019 at 15:10
27

depending on what you're looking for:

Open GL Implementation

You can use glxinfo, from the mesa-utils package:

sudo apt-get install mesa-utils

glxinfo | grep "OpenGL version"

Development Libraries

this depends a little,

dpkg -s [package name]

will tell you version information, etc. of any package.

but you'll need to know what specific part/implementation, etc. of opengl you're interested in. i suspect, for you, it'll be:

dpkg -s libglu1-mesa
19

Note: I've added this answer at a later date, because none of the existing answers address a crucial aspects regarding ssh, and will give misleading values to those who follow the above instructions.

  1. Use X-forwarding when ssh-ing. This is enabled with ssh -X.

    Without x-forwarding:

    $ ssh MYCOMP
    $ glxinfo
    Error: unable to open display
    

    With x-forwarding:

    $ ssh -X MYCOMP
    $ glxinfo | grep -i opengl
    OpenGL vendor string: NVIDIA Corporation
    OpenGL renderer string: GeForce 8800 GT/PCIe/SSE2
    OpenGL version string: 2.1.2 NVIDIA 310.44
    OpenGL shading language version string: 1.20 NVIDIA via Cg compiler
    OpenGL extensions:
    

    I should note here that this is both the wrong graphics card, and wrong version numbers. ('Wrong' in terms of what you would expect).

  2. Set DISPLAY variable to :0, to allow access to the graphic card's driver from the remote session.

    $ ssh -X MYCOMP
    $ DISPLAY=:0
    $ glxinfo | grep -i opengl
     OpenGL vendor string: NVIDIA Corporation
     OpenGL renderer string: GeForce GTX 550 Ti/PCIe/SSE2
     OpenGL version string: 4.3.0 NVIDIA 310.14
     OpenGL shading language version string: 4.30 NVIDIA via Cg compiler
     OpenGL extensions:
    

    This lists the correct graphics card (the one on the remote computer), as well as the correct version numbers.

1
  • For me, it was localhost:10.0, unfortunately resulting in X Error of failed request: GLXBadContext.
    – phil294
    May 17, 2017 at 22:18
5

For those who only want the version number, for example to give it in argument of a program, you can use

$ glxinfo | awk '/OpenGL version/ {print $4}'
3.0

Note: optirun glxinfo | awk '/OpenGL version/ {print $4}' if you are using bumblebee

5

You can get the information by running following command:

DISPLAY=:0 glxgears -info | grep GL_VERSION

This echos something like:

GL_VERSION    = 3.3.0 NVIDIA 340.93

Also try without DISPLAY=:0 in case of problems. The command glxgears is in mesa-utils package which can be installed with:

sudo apt-get install mesa-utils
1
  • 1
    This work for me. Freescale iMX6 Yocto poky 1.6.2.
    – JustWe
    Apr 25, 2017 at 6:58
2

Ubuntu 17.10, open terminal and type;

glxinfo | grep "OpenGL version"

You will recieve something like this;

OpenGL version string: 3.0 Mesa 17.2.2

If you receive an error that the program glxinfo is not available, you will need to enter the command

sudo apt install mesa-utils
2

Type nvidia-settings and go to Graphics information > OpenGL. Look up a value of the Version: property, it's going to be something like 4.6.0 NVIDIA 450.66

1
  • that's not a terminal command, it's a GUI. they're over SSH
    – Shanteva
    Oct 27, 2023 at 19:42
1

If you have root access to a remote computer running Ubuntu 16.04, you could run

user@local_computer:~$ ssh [email protected]
root@remote:~# export DISPLAY=:0
root@remote:~# export XAUTHORITY=/var/lib/lightdm/.Xauthority
root@remote:~# glxinfo | grep -i "OpenGL version"
OpenGL version string: 3.0 Mesa 11.2.0
1
  • even works with the Secure Shell App Chrome Extension (term) and from 18.04 on X to 20.04 on Wayland
    – WiR3D
    Jun 26, 2020 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .