jshbrntt
jshbrntt

Reputation: 5405

GLFW returning the wrong GL_VERSION

In GLFW I'm setting OpenGL context version via:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

However when I print it to the console after glfwMakeContextCurrent(window); and glewInit(); via:

Log::brightWhite("OpenGL version:\t");
Log::white("%s\n", glGetString(GL_VERSION));
Log::brightWhite("GLSL version:\t");
Log::white("%s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));

I get the following:

enter image description here

Why is it 4.3 and not 2.0?

Upvotes: 1

Views: 1042

Answers (1)

derhass
derhass

Reputation: 45362

Because the implementation is free to give you any version it likes, as long it is supporting everything which is in core GL 2.0. You typically will get the highsest supported compatibilty profile version of the implementation. There is nothing wrong with that.

Note that forward and backward compatible contexts and profiles were added in later versions, so when requesting a 1.x/2.x context, this is the behavior you should expet. Note that on OSX, GL 3.X an above is only supported in core profile, so you will very likely end up with a 2.1 context there.

Upvotes: 3

Related Questions