How to limit OpenGL to v1.2 function

I’m making a Simulator and i wish to limit my players to
OpenGL 1.2 maximum. I need this for small computers.
How can i limit to the player machine with a function inside my game, or my script code c++ “not to play with more than” GL1.2 or better to render in GL-1.2 .There is a function for this?
i need only 1.2 not more, i’m Newbie.
Thanks ALan

One way is to use the GLFW library:

int major, minor, revision;
glfwGetGLVersion(&major, &minor, &revision);

Why would you do that?

It is up to you to decide which version of OpenGL is required for your application. If you don’t want functionality above 1.2, just don’t use functions requiring 1.3 and up.

Still, why would you want to do this? What’s your target hardware exactly?

He said it was for “small computers”. I suppose that means either very old ones or cheap GPUs like the GMAs. But I think it is hard to find hardware that doesn’t support newer versions. My old GMA 950 was bad but it could still run shaders. How old GPUs are we talking about? Voodoo1?

You aren’t confusing MS Windows outdated built-in 1.2 libraries with the capabilities of the computers (in case we are talking about MS Windows, which was not stated)? With GLEW, you can get support for newer versions without installing a new OpenGL DLL. The support is already in the drivers, you just need the interface, and GLEW does that.

This, exactly.

OpenGL 1.2 is really going back a long long way. An NVIDIA TNT2 could do OpenGL 1.4, and we’re talking about the last century here.

The price of a beer will get you a GL 2.1 capable accelerator on eBay. There’s no excuse to be still limited to 1.2 in 2012.

Unless you’ve specifically identified that you definitely do have a target audience that imposes this limit on you, I say - ignore it. Go for at least 2.1, and never mind that to a newcomer shaders may seem complex. Once you’ve seen a comparison between the mess of glTexEnv/glTexGen calls needed to set up any kind of moderately non-trivial texture blend, and the equivalent expressed in shader code, you’ll never look back.