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

查看:606
本文介绍了为什么我的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,与

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,而苹果公司表示它支持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天全站免登陆