我正在 Mac 上工作,我已经编译并安装了 FreeGlut,但我似乎无法使用它获取 OpenGL 3.2 上下文。不过,我在使用 GLFW 时可以毫无问题地获取它。
所以在 GLFW 中,这段代码工作得很好:
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)
但是对于 FreeGlut,这段代码失败了(在glutCreateWindow
):
glutInitContextVersion (3, 2);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutInitWindowSize (width, height);
glutInitWindowPosition (300, 200);
int window = glutCreateWindow (argv[0]);
它失败的错误是:
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
我正在 MacOS X 10.8 Mountain Lion 上运行,配有 Intel HD4000 显卡,安装了 XQuartz 作为我的 X11 服务器,并从源代码编译并安装了 FreeGlut 2.8。
有谁知道可能是什么问题?