I am using the Windows 7. I am programming using the OpenGL on it. But I found that there are some features I can use. So I want to check the version of the OpenGL on my sys
The easiest and fastest way is to use a diagnostic tool like GPU Caps Viewer.
You can also use glGetString(GL_VERSION)
but remember that the version which you'll have displayed is the version of a given OpenGL context - which is not necessarily the highest your GPU can do.
However, if you create the context with default settings, you'll probably get the highest possible OpenGL context in compatibility profile, so yes, this method can be useful.
Also, as the glGetString(GL_VERSION)
refers to a given OpenGL context, you need to have it created beforehand. Actually, a GL context is required to call any gl*
function.
Indeed, upgrading the drivers may give you a higher GL version, but it's unlikely that the major version would change. For example, if you'd find yourself having support for GL 3.1, it's very likely that the latest drivers will give you GL 3.3, but not GL 4.0.