I created OpenGL context on Windows 7 machine as described on https://www.opengl.org/wiki/Creating_an_OpenGL_Context_(WGL) .
Context was created successfully, but there seems to be some problems.
Since I need vertex/fragment shaders, I need at least OpenGL version 2.0 (or some extensions). After context is initialized and glewInit is called, I checked OpenGL context version using following commands:
- glewGetString(GLEW_VERSION) which returns "1.9.0"
- glewIsSupported("GL_VERSION_2_0") which returns 1
It seems odd that two GLEW functions report differend version. Both are (partially) explained on http://glew.sourceforge.net/basic.html .
Also I think that OpenGL version should be at least 4.0 for nvidia gtx 460. I'd also like to add that all shader/program function pointers (eg. glUseProgram) are not NULL pointers, and they work.
Is there a reliable way to tell the OpenGL version for created context?
Edit: Ok here is the solution. It seems that OpenGL/GLEW have similar function/parameter names which return different versions. This is the summary:
- glewGetString(GLEW_VERSION) returns GLEW version
- glGetString(GL_VERSION) returns OpenGL version but works only for OpenGL below version 3.0
- glewIsSupported("GL_VERSION_2_0") checks if OpenGL version 2.0 is supported
- if (GLEW_VERSION_2_0) checks if OpenGL version 2.0 is supported (not GLEW!!!)
- glGetIntegerv(GL_MAJOR_VERSION) and glGetIntegerv(GL_MINOR_VERSION) return OpenGL version, but are available only on OpenGL 3.0 and up
Regards