Can't Create 4.0 Context on GeForce 970GTX

Hi Guys

I’ve copied and pasted the sample code in the “Putting it together” section from http://www.glfw.org/docs/latest/quick.html. The default code compiles and render the rotating colored triangle.

However when I try to change the context version from 2.0 to 3.2+, it simply stops rendering and I am left with a blank screen. No error messages are printed to the terminal either. When checking the version, it always return 3.2.1. I simply changed version hint lines from:

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

to:

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

and added the following lines directly after:

  glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

Config:
GLFW 3.2.1
Visual Studio 2015 (x64)
nVidia GeForce 970 GTX (OpenGL 4.4)
Windows 7, Ultimate SP1, x64

(Please note that if I specify the profile as GLFW_OPENGL_COMPAT_PROFILE, it works, but it is still using a 3.2.1 context. I’m pretty sure the code in that example is compatible with OpenGL 4.0 Core profile as well. )

Am I doing something obviously wrong?

Cheers
-Vinnie

The glfwGetVersion function returns the version of GLFW, not the version of the current context. See glfwGetWindowAttrib instead.

Also, if the code uses OpenGL 2.0 then it will fail on a core profile context, among other reasons because it doesn’t set up a vertex array object.

Cheers, that cleared up the version issue.

I’ll try and write a bare minimum core profile test tomorrow.