OpenGL code not running : OpenGL GLX extension not supported by display

roynalnaruto picture roynalnaruto · Apr 14, 2014 · Viewed 10.1k times · Source

I have to run a code, it includes libraries GL/glut.h and GL/glew.h. The code gets compiled well, by the instruction:

$ gcc test.c -lglut -lGLEW -lGL

But when I run it, I get the following error:

freeglut (./a.out): OpenGL GLX extension not supported by display ':0.0'

The same code did work on my other system, which has suddenly broken down and not even booting, so I HAVE to get it done on this one.

The output of $ glxinfo is:

name of display: :0.0
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Error: couldn't find RGB GLX visual or fbconfig

Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".

Also, the output of $ lspci is:

00:00.0 Host bridge: Intel Corporation Device 0150 (rev 09)
00:01.0 PCI bridge: Intel Corporation Device 0151 (rev 09)
00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)
00:1a.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation Cougar Point High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 1 (rev b4)
00:1c.5 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 6 (rev b4)
00:1d.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation Device 1c5c (rev 04)
00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation Cougar Point SMBus Controller (rev 04)
01:00.0 VGA compatible controller: nVidia Corporation GT218 [GeForce 210] (rev a2)
01:00.1 Audio device: nVidia Corporation High Definition Audio Controller (rev a1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

Please help me out, I think the nvidia display drivers aren't properly installed, but I cannot manage to solve this problem. I also have CUDA installed.

Answer

datenwolf picture datenwolf · Apr 14, 2014

This is not a programming problem, but a system configuration issue. Essentially it tells you, that your system's configuration doesn't support OpenGL.

GLX is the X11 protocol extension used to setup OpenGL contexts on X11 drawables. However this is an extension provided by the device driver. You are using a NVidia card. My guess is, that this is a vanilla installation of a system that doesn't automatically install the proprietary nvidia drivers and neither configures the open nouveau drivers.

So the X11 server probably uses either the nv or the fbdev or the vesa driver; none of those support OpenGL/GLX.

Solution: Install and configure the proper driver. Either nouveau or the drivers you can download from http://www.nvidia.com/object/unix.html and install that.

You say you have CUDA installed, then you must configure the nvidia driver in the /etc/X11/xorg.conf file, since if nouveau or nv are installed as well the precede it.

Also keep in mind, that every time you do a kernel update you have to reinstall the CUDA drivers.