MacOS uses the default Legacy Profile for the entire OpenGL context created. Therefore, by default, only OpenGL up to 2.1 and GLSL up to 1.20 are supported.
To use OpenGL 3.2+, you need to switch to the Main profile . The naming there is a bit confusing because it only defines the 3.2Core profile, but it is actually 3.2 or newer (each OpenGL profile is supported by the system / driver, which is backward compatible with 3.2)
For a glut (depending on the glut version, if it works) the command on MacOS is:
glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | ... )
Where | ... | ... will be other parameters that you want to pass to glutInitDisplayMode .
About glew , you usually don't need glew on MacOS because of the way the OpenGL layer is implemented on MacOS. You are limited by the OpenGL features provided / provided by MacOS. Thus, either functions are available through MacOS headers or not. There, the title will be #include <OpenGL/gl3.h> , where naming is also a pass, this does not mean only OpenGL 3, it is the same as in the context.
I would recommend using GLFW , this is a great cross-platform library, similar to GLUT , but it seems to me better to use. There you would switch the context as follows:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
t.niese
source share