为什么我的 OpenGL 版本在 Mac OS X 上总是 2.1? [英] Why is my OpenGL version always 2.1 on Mac OS X?

查看:34
本文介绍了为什么我的 OpenGL 版本在 Mac OS X 上总是 2.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using GLFW 3.0 on Mac OS X 10.8, graphic card is Intel HD Graphics 5000

我的 OpenGL API 版本是 2.1,由

And my OpenGL API version is 2.1, aquired by

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,不像 报告的 3.2.我的操作系统已经升级到10.9,OpenGL版本还是2.1.

The version is always 2.1, unlike the reported 3.2. My OS has been upgraded to 10.9, and OpenGL version is still 2.1.

它仍然无法编译 GLSL 3.3,而 Apple 表示它支持 4.1.我如何访问更高版本的库?

It still cannot compile GLSL 3.3, while Apple says it supports 4.1. How do I access higher versions of the library?

推荐答案

在创建窗口之前,您需要添加forward_compat"和core_profile"提示.

You need to add both "forward_compat" and "core_profile" hints before creating the window.

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 );

这篇关于为什么我的 OpenGL 版本在 Mac OS X 上总是 2.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆