I am trying to understand what glGetString(GL_VERSION) return as I get strange results when I use this function. Does this return the maximum opengl version supported by my GPU or the oepngl version of the current context created. According to Which version does glGetString(GL_VERSION) get? this return the opengl version of current context created but I think that is not the case. I want to forcefully create opengl context 3.1 (forward compatible), opengl context 2.0 and opengl context 1.1. Following are my observations
case 1: Using wglCreateContextAttribsARB to create context. I think it is returning the highest opengl context version Subcase 1:
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0
};
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
Subcase 2:
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
Subcase 3:
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
WGL_CONTEXT_MINOR_VERSION_ARB, 0,
0
};
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
Subcase 4:
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 1,
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
0
};
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
case 2: Using glut to create opengl context
Subcase 1:
glutInitContextVersion (3, 1);
glutInitContextFlags (GLUT_FORWARD_COMPATIBLE);
//glGetString(GL_VERSION) returns "3.1.0 - Build 10.18.14.4264"
Subcase 2:
glutInitContextVersion (2, 0);
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
Subcase 3:
glutInitContextVersion (1, 1);
//glGetString(GL_VERSION) returns "4.3.0 - Build 10.18.14.4264"
Can someone explain this behaviour. I can post full code where I create the context. Also can someone please guide me how can I create opengl 3.1 (Forward compatible context), opengl 2.0 context and opengl 1.1 context both using glut and wglCreateContextAttribsARB?