Context creation for extensions

I have been trying to create a 2.1 opengl context so that I can use VBOs with hardware acceleration. I have been messing with this for 3 solid days. I am completely at my wits end. I have updated all my drivers. I have the absolute latest version of GLEW with all the various dlls and libs in the right place. I have deleted all prior older versions of all the dlls and libs. I have run OpenGL Extensions Viewer and my card can run render tests natively in all opengl versions up to 2.1, and in “Forward” contexts up to 3.3. Can someone please help me?

I will try to include everything you need to know about my computer.

Operating System
Windows Vista Home Premium Version 6.0.6002 (Service Pack 2 Build 6002)

Visual C++ 2008 Express Edition
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP

System Info------
Renderer GeForce 8800GTS/PCI/SSE2
Adapter RAM: 640 MB
Monitor Generic PnP Monitor

Version: 3.3
Driver version:
ForceWare (R) N/A

9.0c - February 2010, 10.0
Shader model: vs_4_0, ps_4_0

(i) Renderer Info

Vendor: NVIDIA Corporation
Rendered: GeForce 8800 GTS/PCI/SSE2
Version: 3.3.0
Shading Language version: 3.30 NVIDIA via Cg Compiler
Memory: 640 MB

OpenGL Extensions Viewer|Rendering Tests
[v] 1.1 Passed 223
[v] 1.2 Passed 240
[v] 1.3 Passed 242
[v] 1.4 Passed 232
[v] 1.5 Passed 241
[v] 2.0 Passed 170
[v] 2.1 Passed 171

Here is the source.

At the bottom glGetString(GL_VENDOR) returns a zero.
glGetError() then returns GL_INVALID_OPERATION

This is a telltale sign that I have not actually create a 2.1 context correctly. For the life of me, I cannot see where the problem is.

You try to create a forward-compatible 2.1 context - the wgl_ARB_create_context spec says the following:

“If the WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is set in WGL_CONTEXT_FLAGS_ARB, then a <forward-compatible> context will be created. Forward-compatible contexts are defined only for OpenGL versions 3.0 and later.”


"On failure wglCreateContextAttribsARB returns NULL. Extended error information can be obtained with GetLastError. Conditions that cause failure include:

  • If attributes WGL_CONTEXT_MAJOR_VERSION_ARB and WGL_CONTEXT_MINOR_VERSION_ARB, when considered together with WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, specify an OpenGL version and feature set that are not defined, then ERROR_INVALID_VERSION_ARB is generated."

So i guess that wglCreateContextAttribsARB returned a NULL context.

You never really stated what your problem is. That is, you do X and Y happens when you expect Z to happen. You also didn’t post your context creation code.

There is nothing you can do to force the drivers to give you a 2.1 context, if they support GL 3.2 or later. WGL_ARB_create_context_profile allows implementations to substitute higher GL versions even if you ask for lower ones, so long as the profile it returns is backwards-compatible with the version you asked for. If you ask for 2.1, it can give you 3.3 compatibility profile because the 3.3 compatibility profile is backwards compatible with 2.1.

Also, what mbentrup stated if you’re trying to ask for a 2.1 forward compatible context.

Thank you for your replies.
I was operating under the following assumption.

Everyone starts with a 1.1.0 context on their first context creation. GL_VENDOR,GL_VERSION, if retrieved at that time, returns “Microsoft Corporation”, “1.1.0”. In order to get hardware acceleration, VBOs, etc, another context must be created to forward the opengl version to 3.0 or later. Even if the card does not natively support 3.0 at the hardware level, this will at least allow subsequent code to utilize 1.5 core functions, or 2.1 core functions, or whatever the card natively supports. An example would be glBindBufferARB()

The above paragraph is completely false. But this is the assumption I was operating under for several days. I have since found out that even at the first context creation, you can get “nVIDIA”, “3.3.0” No, rather you should get that, if your ICD is correctly installed. Getting “Microsoft Corporation” for your vendor is an indication that something is wrong with your driver install.

Where I had the most luck was getting the very latest version of GLEW, and then overwriting whatever libs came shipped with my compiler with the glew libs. Also, I copied glew32.dll into my /system32/ folder. After that I stopped getting the Microsoft rasterizer-emulator on my first context creation, and I saw my real GPU vendor. Use of GLEW in all source code files removes the burden of having to go through the wglGetProcAddress(“glCoreFunctionHere”) procedure.

The above paragraph is completely false.

Where did you find that misinformation?

Getting “Microsoft Corporation” for your vendor is an indication that something is wrong with your driver install.

That’s not the only reason to get that problem. It can also happen when you use a pixel format that your installed driver doesn’t allow.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.