macos - 为什么我的 OpenGL 版本在 Mac OS X 上总是 2.1?

标签 macos opengl glfw

我在 Mac OS X 10.8 上使用 GLFW 3.0,显卡是 Intel HD Graphics 5000

我的 OpenGL API 版本是 2.1,由

glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);

编译选项:
g++ ... -framework OpenGL -framework Cocoa -framework IOKit ...

标题:
#include <GLFW/glfw3.h>
#include <GL/glu.h>

版本总是 2.1,不像 the reported 3.2 .我的操作系统已经升级到 10.9,OpenGL 版本还是 2.1。

它仍然无法编译 GLSL 3.3,而 Apple says it supports 4.1 .如何访问更高版本的库?

最佳答案

在创建窗口之前,您需要添加“forward_compat”和“core_profile”提示。

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwCreateWindow(640, 480, "Hello World", NULL, NULL );

关于macos - 为什么我的 OpenGL 版本在 Mac OS X 上总是 2.1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19658745/

相关文章:

c++ - 如何使用 GLFW 在 openGL 中旋转相机?

c++ - 如何将 C++ Boost 集成到 Qt 项目中?

macos - pbpaste 命令在写入目标文件之前删除剪贴板内容中的换行符

C++ 文件解析器/stdin 输入——这个算法行得通吗?

ios - 对齐顶点数据

c++ - 在 opengl c++ 中计算顶点法线(gouraud 着色)

c++ - 运行时带有加载光标的 openGL GLFW 白屏

c++ - GLFW 无法创建 4.3 上下文

macos - 使用 AppleScript 为文件设置标签

python - 在 Homebrew 程序中使用系统Python