Hi,
I have created an OpenGL context in what I believe is the proper way, but on Linux, basic calls such as `glGetString(...)`, `glGetIntegerv(...)` are returning bogus values/no-ops. Despite this, the context seems to render everything fine. On Windows, I follow the same algorithm and it works perfectly.
Fortunately, since I've been having this problem for such a long time, I've had the opportunity to make some very pretty debug output. In case it isn't obvious, in the following, red is a frame/window, cyan is an OpenGL context, yellow is an API pointer, and violet is the display server handle.
Here is the output on Windows:
[sharedmedia=gallery:images:7659]
The algorithm is as follows:
- (line 1): Create a basic context on a default frame
- (lines 3-5): Set the basic context as current, load its API pointer for `wglCreateContextAttribsARB(...)`, unset context.
- (lines 7-9): Set the basic context as current, call the API pointer to create an attribute context
- (lines 11-13): Set the attribute context as current, and set it up (including loading its API pointer, which happens to be the same; we don't use it ever, though).
- (line 15): Set attribute context as current in preparation for main loop.
- (line 15.5): [Main loop]
- (line 16): Unset the attribute context.
- (lines 18-19): Cleanup.
Now, I try to do something very similar on Linux:
[sharedmedia=gallery:images:7658]
Unfortunately, it doesn't work. Notice the error after line 12. At that point, I called `glGetString(...)` and it returned null. This should not be possible. A context is bound (line 11). Crucially, there is no GL error--yet the only case the documentation says null is returned is if an error happened. In fact, no OpenGL error occurs at all, anywhere!
Basically, I want to know why this happens, and prevent it. Did I screw up the context creation somehow? Why wouldn't it throw an error? Is this OpenGL driver just terrible?
---
One other potentially-relevant fact: on AMD CodeXL, I get the following output on Windows:
Debug String: CodeXL warning: The debugged process asked for an extension function pointer (wglCreateContextAttribsARB) from one render context, but called this function pointer in another render context (context #1)
This should not be possible either; as you can see, that function is only ever called when the basic context is bound, using the pointer loaded while the basic context was bound. Additionally, at the time this message appears, only one context had been created, so . . .
Thanks,
-G