How to run Several versions of OpenGL

Hello, I'm new to game developing in C++ and I would really like to know how to run two different versions of OpenGL, In this case I want to use OpenGL 2.1 while my PC has OpenGL 4.4.
I have already googled the internet and there's no info that I could find.

Generally you cannot request an OpenGL context of a specific version. The GLW API, which is the link between OpenGL and the Windows system allows the application to specify an OpenGL version, but it will return a context of any version that is upwards compatible with the requested version.

So if you request an OpenGL 2.1 on your PC you'll probably create an OpenGL 4.4 context using the compatibility profile, because that is upwards compatible to OpenGL 2.1.

On the one hand this means that you can run any OpenGL 2.1 program on your OpenGL 4.4 system, but on the other hand it will happily allow you to use compute shaders or tesselation, which aren't supported in a "pure" OpenGL 2.1 context.

So you can develop for OpenGL 2.1 on a OpenGL 4.4 system, but to guarantee that the application works on any 2.1 system, you have to test on old drivers or check otherwise that you don't use any of the newer features.

You can request specific GL version with wglCreateContextAttribsARB by specifying attributes like WGL_CONTEXT_MAJOR_VERSION_ARB and WGL_CONTEXT_MINOR_VERSION_ARB.
The tricky part is to get to this function.
1) You first need to use the ordinary wglCreateContext to get "some" context and make it current because wglGetProcAddress requires you to have current context.
2) Then use wglGetProcAddress to get wglCreateContextAttribsARB.
3) make the fisrst context non-current and destroy it.
4) use wglCreateContextAttribsARB to create a new context with the desired properties (GL version or others) and make it current.

I know, its quite a mess. At least you can use single window for all this (the one in which you will actually draw).

Ah, yes, the context returned by wglCreateContextAttribsARB may not actually be exactly of the version you requested. The function spec only says the new context will be "compatible" to the requested, for some quite complicated definition of "compatible".
Read the specification in http://www.opengl.org/registry/specs...te_context.txt