PDA

View Full Version : Can not create OpenGL 4.2 context on openSUSE



ZHAO Peng
11-23-2011, 09:55 PM
Hello,

I tried to test OpenGL 4.2 on OpenSUSE 12.1 using glew 1.7, freeglut and nvidia driver 285.05.09. The graphics card is GTX 570.
An error occurred when trying to create context.
"X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 135 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 63
Current serial number in output stream: 64"

When I tried to create OpenGL 4.1 context everything is OK. It seems this driver doesn't support OpenGL 4.2 although it should be.
Any ideas? Thanks!

ZHAO Peng

Dark Photon
11-24-2011, 05:15 AM
Let's see your window and context create code. When I've seen BadMatch it's caused by things by not attaching a colormap to the X window or something like that.

ZHAO Peng
11-24-2011, 07:08 PM
Thanks for your reply!
The codes are as follow
" glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DEPTH|GLUT_RGBA | GLUT_DOUBLE);
glutInitContextVersion(4,2);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutInitWindowSize (700, 700);
glutInitWindowPosition(10, 10);
glutCreateWindow("opengl 4.2 application");"

These are very common steps for glut application. And I have tried the OpenGL 4.2 samples from g-truc.net which also produced the error message. The other users of openSUSE 12.1 also have the same problem. I don't know how about the other distribution.

By the way, the glxinfo can create OpenGL 4.2 context and if I don't call " glutInitContextVersion(4,2); glutInitContextProfile(GLUT_CORE_PROFILE);" the nvidia driver can create default OpenGL 4.2 driver without profile information. Really strange!

thokra
11-25-2011, 02:27 AM
This looks more like a bug in FreeGLUT. glxinfo does nothing else than have X create a default GL context. Usually this is the highest versioned compat context the driver will provide.

You can always try another windowing toolkit, like SDL or Qt. If one if these succeed then its GLUT.

Victor Zamanian
11-26-2011, 06:45 PM
I can't create an OpenGL 4.2 context either. I have a GeForce GTX 580 with Nvidia drivers 290.10 and I'm running Ubuntu 11.10. I use GLFW to create the context, and creating a 4.1 context is fine, but it fails when creating a 4.2 context. So it's probably not freeglut.

ZHAO Peng
11-26-2011, 10:35 PM
There is the same problem using Qt which means it is not related with freeglut. I am not sure it is the problem of Nvidia driver or x server.

Dark Photon
11-27-2011, 06:21 PM
Let's eliminate GLUT and Qt as possible causes of this problem and try with raw GLX and X11. Try the context creation code at the top of this post:

* Re: Offscreen rendering (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=268825#Post2688 25)

Just change the GLX_CONTEXT_MAJOR_VERSION_ARB number to 4 and the GLX_CONTEXT_MINOR_VERSION_ARB to 2.

Compile with:
g++ -o tst tst.cxx -lGL -lX11

ZHAO Peng
11-27-2011, 08:46 PM
Thanks for your suggestion!
I gave a try and got results as follow.

When set GLX_CONTEXT_MAJOR_VERSION_ARB number to 4 and the GLX_CONTEXT_MINOR_VERSION_ARB to 2.
"GLX version = 1.4
Getting framebuffer configs
Found 2 matching FB configs.
Chosen visual ID = 0x3a
Creating colormap
Creating window
Mapping window
Creating context
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 135 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 35
Current serial number in output stream: 36
"

When set GLX_CONTEXT_MAJOR_VERSION_ARB number to 4 and the GLX_CONTEXT_MINOR_VERSION_ARB to 1.
"GLX version = 1.4
Getting framebuffer configs
Found 2 matching FB configs.
Chosen visual ID = 0x3a
Creating colormap
Creating window
Mapping window
Creating context
Created GL 4.1 context
Verifying that context is direct
Making context current
"

I think freeglut and Qt are innocent and this problem may be related to Nvidia driver and X server. What next step can we do to clarify this problem? :confused:

ZHAO Peng
11-28-2011, 12:48 AM
Message from Nvidia on Nv News. Here (http://www.nvnews.net/vbulletin/showthread.php?t=169133)

This is a known issue that we'll try to get fixed soon. I think you can work around the problem simply by creating an unversioned "compatibility profile" context, but I'll have to check tomorrow.

OK, it's clear. Just waiting!

Victor Zamanian
12-10-2011, 11:44 AM
Ah, great! I'm glad to hear a fix for this is underway. :-)

Victor Zamanian
12-12-2011, 07:41 AM
This is kind of odd. I've downloaded GLFW's source distribution. It comes with a small test program called 'version', which opens a window and polls the context information.

These are tests I've done at my work computer, which has a GeForce GT 520 GPU.


$ ./version
GLFW header version: 2.7.2
GLFW library version: 2.7.2
OpenGL context version string: "4.2.0 NVIDIA 290.10"
OpenGL context version parsed by GLFW: 4.2.0
OpenGL context flags: none
OpenGL profile mask: 0x00000000 (unknown)
OpenGL context renderer string: "GeForce GT 520/PCI/SSE2"
OpenGL context vendor string: "NVIDIA Corporation"
OpenGL context shading language version: "4.20 NVIDIA via Cg compiler"

Apparently it successfully opens a 4.2 context when not specifying the major and minor version numbers. But when explicitly asking for a 4.2 context, I get these errors:

$ ./version -m4 -n2
Setting OpenGL context version hints!
X Error of failed request: GLXBadContext
Major opcode of failed request: 130 (GLX)
Minor opcode of failed request: 5 (X_GLXMakeCurrent)
Serial number of failed request: 60
Current serial number in output stream: 60
X Error of failed request: GLXBadContext
Major opcode of failed request: 130 (GLX)
Minor opcode of failed request: 4 (X_GLXDestroyContext)
Serial number of failed request: 62
Current serial number in output stream: 68

Also when asking for specific profiles, I get errors -- both when explicitly asking for a 4.2 context and when not.


$ ./version -p core
Failed to open GLFW window
$ ./version -p compat
Failed to open GLFW window

Asking for specific profiles for lower versions (3.0, 3.1, 3.2, 3.3, 4.1) works OK.

Leith Bade
12-12-2011, 12:26 PM
It seems the NVIDIA driver is happy to give you a 4.2 context by default (ie no version number in create context).

But when you explicitly ask for 4.2 with a version number in create context it barfs.

I would not be surprised someone forgot to add a new if/else statement for 4.2 to the create context function.