Determining OpenGL version

Hi!

When compiling basic OpenGL stuff under WindowsXP (Using VisualStudio .net) I realized that I included the opengl headers from the PlatformSDK, and also linked to the standard opengl32.lib.
For some reason, the glGetString(GL_VERSION) returns an invalid pointer, so I couldn’t determine the version from there.
Thinking again I looked into the gl header file which told me that the version was 1.1.
Now, if I want to use, say opengl 1.2, and use Nvidias opengl implementation, I can download their implementation (or SDK) and use their headers and libraries right?
I guess the same goes for ATI.
But whatif I want my application to dynamically determine the opengl version installed on a windows machine and then follow an architecture optimized path (e.g. choose nvidia if an nvidia card is present).
How do I determine what version is present?
Or am I missing something?

For some reason, the glGetString(GL_VERSION) returns an invalid pointer, so I couldn’t determine the version from there.

Probably because you tried to call it without creating a rendering context. That won’t work.

Now, if I want to use, say opengl 1.2, and use Nvidias opengl implementation, I can download their implementation (or SDK) and use their headers and libraries right?

No. The only library you use is the one provided by Microsoft. It is the interface between OpenGL on Windows and your application. The hardware manufacturers only provides the underlaying implementation in their drivers.

But whatif I want my application to dynamically determine the opengl version installed on a windows machine and then follow an architecture optimized path (e.g. choose nvidia if an nvidia card is present).
How do I determine what version is present?

The only way to determine it (possibly except for hardware specific registry keys), is to create a rendering context and call glGetString(GL_VERSION).

For more information on OpenGL 1.2+ on Windosw, look here .

Thanks! That erroneous pointer gave me a headache last night…seems my foray into Java has been going on too long.