GLFW opens the context of OpenGL 3.2, but Freeglut cannot - why?

I'm working on a Mac, I have compiled and installed FreeGlut, but I can’t get the OpenGL 3.2 context. However, I can get it without any problems when using GLFW. Therefore, in GLFW, this code works fine:

glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2); glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwOpenWindow(500, 500, 8, 8, 8, 8, 24, 8, GLFW_WINDOW) 

But this code does not work with FreeGlut (on glutCreateWindow ):

 glutInitContextVersion (3, 2); glutInitContextProfile(GLUT_CORE_PROFILE); glutInitWindowSize (width, height); glutInitWindowPosition (300, 200); int window = glutCreateWindow (argv[0]); 

Error in error:

 X Error of failed request: BadRequest (invalid request code or no such operation) Major opcode of failed request: 34 (X_UngrabKey) Serial number of failed request: 29 Current serial number in output stream: 29 

I am running MacOS X 10.8 Mountain Lion with Intel HD4000 graphics, installing XQuartz as my X11 server, and compiling and installing FreeGlut 2.8 from sources.

Does anyone know what the problem is?

+8
opengl glfw macos freeglut glut
source share
3 answers

In 10.8 and 10.7, GL 3.2 is available if you explicitly call it when setting up the GL context. Apple calls this the “Core Profile” different from the “Legacy Profile,” which is GL 2.1.

I ran into this problem with Wine on OSX, it does not support OpenGL 3.2. I understand that the X11 server (or Apple X11 or XQuartz) does not currently support 3.2, and there is no switch to switch there to enable it. This may be due to compatibility, as profile 3.2 will break some existing GL applications.

This post suggests using GLFW (or maybe Apple GLUT.framework, if there is such a thing)

This page explains the GL stack on OSX and confirms release 2.1 with GLX.

+1
source share

Freeglut is an advanced implementation of the SGI GLUT Toolkit, and (with a few exceptions due to outdated hardware) implements the same functions.

Unfortunately, this includes a number of functions that break down in the strict implementation of CORE / FORWARD COMPATIBLE.

Typically, if you request a context WITHOUT specifying a version or profile, you will get the best that a combination of the GL driver and toolkit can offer, which is usually a compatibility profile rather than a main profile.

Please note that the only thing you have lost with the compatibility profile is the alleged check for obsolete functions. All new main function should work without problems.

This problem with freeglut is not limited to Apple; it also manifests itself in Linux using some Gallium drivers. It is not clear if there are any short-term intentions to fix this, so if you need to use CORE / FORWARD COMPATIBLE, you should probably switch to GLFW or SDL.

0
source share

You need to enable the flag. usually by version. It should look something like this:

 glutInitContextFlag(GLUT_FOWARD_COMPATIBLE); 
0
source share

All Articles