我正在使用Mac电脑,已经编译并安装了FreeGlut,但是似乎无法通过它获取OpenGL 3.2上下文。然而,在使用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。
有人知道可能出现什么问题吗?