PDA

View Full Version : How to get an OGL4 context on Linux with NV 256.38



sse3optimized
09-03-2010, 09:10 PM
I'm just getting started with OGL again (last time using GL2 ...) and I'm running into a weird issue. I just dug out my old stuff, and I want to create an OpenGL 4.1 context and use for instance ARB_debug_output.

My OS is Ubuntu 10.04 x64, with an ION2 chipset and the NVIDIA 256.38.03 driver. However, glxinfo only says version 3.3.0, and using glew from SVN I get 4.0 at most, but not 4.1, and ARB_debug_output is listed as OK [MISSING]

The glewinfo output is:

GLEW version 1.5.5
Reporting capabilities of display :0.0, visual 0x2b
Running on a ION/PCI/SSE2 from NVIDIA Corporation
OpenGL version 3.3.0 NVIDIA 256.38.03 is supported

# some stuff omitted
GL_VERSION_4_0: OK

# more stuff omitted

GL_ARB_debug_output: OK [MISSING]



glxinfo does not even list GL_ARB_debug_output. In order to create the context, I create a dummy window first, call glewInit() (so it initializes glXChooseFBConfig), and then I go through a standard initialization which works fine if I request OpenGL 3.2 or 3.3 for instance, but fails for OpenGL 4.0 and 4.1. After initializing, I call glewInit() again.

If I try to get a 4.0 or 4.1 context, I get the following error:

X Error of failed request: BadAlloc (insufficient resources for operation)
Major opcode of failed request: 135 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 24
Current serial number in output stream: 25


My initialization code is based on http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX); but with glewInit mixed in. I changed the code to request a GL 4.0 or 4.1 context to test if that works, but it fails as well.

Creating a 3.3 context works fine; I get EXT_direct_state_access and other extensions, but ARB_debug_output is missing in any case. Trying to get a 3.3 context with the GLX_CONTEXT_PROFILE_MASK_ARB just returns in some bogus context which does not have EXT_direct_state_access (didn't try this further, as the docs say that you have to select a profile.)

I've reinstalled the driver manually after purging everything else, and both nvidia-settings and glxinfo show the correct driver version, but I'm unable to get a 4.0 context. GLew is the latest from SVN, which should be ready for 4.1; at least 4.0 should be working.

How is this supposed to work? I've spent some time searching the web, but my search-foo is not good enough to dig up anyone using GL 4.1 successfully on Linux ... I'm happy for any hint how to get this working.

trinitrotoluene
09-04-2010, 05:53 AM
I think your hardware don't support OpenGL 4.0 and above. Only Fermi video card family support it. Look at this web page (http://developer.nvidia.com/object/opengl_driver.html).

sse3optimized
09-04-2010, 08:09 AM
Yes, it does not support GL 4.0 in hardware, but I should still be able to get a context, shouldn't I? After all, glewinfo shows that all 4.0 extensions are supported (this context might be really slow if I use the tesselation for instance.) Should I try to get a 3.3 context with the forward-compatibility bit instead (which should give me the most extensions?)

I remember "back in the old days" when you ran some stuff which was not HW supported, you would get a software fallback which was insanely slow, but at least it would work.

The other problem is why I don't get access to ARB_debug_output ... the website you linked also mentions that ARB_debug_output should work correctly for GL 2 hardware even.

So it's basically three questions:
* Can you create an OpenGL 4.0 context on 3.3 hardware?
* Is the correct way to do so to create a dummy context, call glewInit, destroy the dummy context, and then create the "real" one?
* Is ARB_debug_output broken in that particular NVIDIA driver or is it GLew's fault?

Rosario Leonardi
09-04-2010, 08:26 AM
* Can you create an OpenGL 4.0 context on 3.3 hardware?
No, on Windowss nVidia have build some developer driver to emulate GeForce8 functionality, with that you can create openGl 3.0 context with a openGl 2 hardware. I don't know if exist something similar for openGL 4.0 on linux

* Is the correct way to do so to create a dummy context, call glewInit, destroy the dummy context, and then create the "real" one?
Yes, you need the first context to get the pointer to glXCreateContextAttribsARB

edit: I usually get the CreateContextAttrib pointer by hand and then after the final context is created I call glewInit (see the reason below)

* Is ARB_debug_output broken in that particular NVIDIA driver or is it GLew's fault?
To get debug output you need a debug context. Cause glewInfo create a regular context it fail to see the extension.

sse3optimized
09-04-2010, 07:42 PM
THanks a lot, this is really the best information I got on this topic so far!