I saw a similar question here: OpenGL 4.1(?) under Mavericks, but it seems that person is relying on glut, so the solution doesn't apply.
I'm on OSX 10.9 (Mavericks), with an NVidia GeForce 650, developing in C++, using GLEW and GLFW.
I'm not using xcode- keeping it simple with a very basic makefile.
Anyways- I have these 5 lines of code:
window = glfwCreateWindow(640,480,"hello world",NULL,NULL);
glfwMakeContextCurrent(window);
glewExperimental = GL_TRUE;
glewInit();
printf("shader lang: %s\n",glGetString(GL_SHADING_LANGUAGE_VERSION));
and it prints out
shader lang: 1.2
I'm assuming setting glewExperimental should handle correctly getting the core context? (/ the stuff the other dude was talking about in the other thread)
What else do I need to do to enable the latest shader versions?
Ps- my full code is here, including the makefile: https://github.com/Phildo/openglexp , but I'm not sure how useful it will be.
I have never used GLFW before, but according to the API documentation and my thorough experience with low-level OS X GL context management, the following code should fix your problem:
glfwInit ();
glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
Make sure you call these things before glfwCreateWindow (...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With