Salomonsson.se
Mar 10 2015

C++ and openGL - Part 2

Continued with the C++ project. Noticed that the sample code for my triangle was in the older glBegin…glEnd format and changed it to the new opengl 3 standard with shaders, only to get a totally black window. Turned out you need to add the following code to enable opengl 3 and core profile:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

Which gave me a triangle once more.

The rest of the evening was spent re-reading about matrix operations, and the Model-View-Projection matrices. It was a long time since I last played around with this. You quickly forget if you do not keep working with it.