带有LWJGL的Mac OSX El Capitan上的OpenGL 3.3 [英] OpenGL 3.3 on Mac OSX El Capitan with LWJGL

查看:108
本文介绍了带有LWJGL的Mac OSX El Capitan上的OpenGL 3.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在2014年中期的Macbook Pro上的LWJGL 3中创建OpenGL 3.3上下文.用于初始化窗口的源代码如下:

I am currently trying to create an OpenGL 3.3 context in LWJGL 3 on my Macbook Pro mid 2014. My sourcecode to initialize the window looks like this:

if (!glfwInit()) {
    Logger.addError("GLFW", "init failed");
}

glfwDefaultWindowHints();

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);           
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_CORE_PROFILE, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

// glfwWindowHint(GLFW_SAMPLES, 2);

ID = glfwCreateWindow(width, height, title, 0, 0);
if (ID == 0) {
    Logger.addError("GLFW", "window creation failed");
}

不幸的是,GLFW无法为任何高于2.1的版本创建窗口,而忽略窗口提示时,版本glGetString(GL_VERSION)返回.
我通读了所有重复"的问题,但是正如您所看到的,我已经请求了核心配置文件和前向兼容性.此外,我安装了XCode并拥有最新版本的操作系统.你们还有其他建议吗,或者我了解任何严重错误吗? 预先感谢...

Sadly GLFW fails to create the window for any version higher than 2.1, the version glGetString(GL_VERSION) returns when leaving out the window hints ...
I read through all of the "duplicate" questions, but as you can see I already request core profile and forward compatibility. Moreover I installed XCode and have the newest version of the operating system. Do you guys have any other suggestions or did I understand anything horribly wrong? Thanks in advance...

请注意,LWJGL 3 afaik中没有"GLFW_OPENGL_PROFILE"标志,因此我无法从官方GLFW入门第1:1页复制代码.将"GLFW_OPENGL_CORE_PROFILE"标志设置为true可以在Windows上运行,尽管这不能成为导致麻烦的错误...

Note that there is no "GLFW_OPENGL_PROFILE" flag in LWJGL 3 afaik, so I can't copy the code from the official GLFW getting started page 1:1. Setting the "GLFW_OPENGL_CORE_PROFILE" flag to true worked on windows though thus this cant be the error making trouble...

推荐答案

设置核心配置文件窗口提示的方式不正确.而是使用:

The way you are setting the core profile window hint is incorrect. Instead use:

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

GLFW文档:

GLFW_OPENGL_PROFILE指定要为其创建上下文的OpenGL配置文件.可能的值是GLFW_OPENGL_CORE_PROFILEGLFW_OPENGL_COMPAT_PROFILEGLFW_OPENGL_ANY_PROFILE之一,以不请求特定的配置文件.如果要求低于3.2的OpenGL版本,则必须使用GLFW_OPENGL_ANY_PROFILE.如果请求OpenGL ES,则将忽略此提示.

GLFW_OPENGL_PROFILE specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE, or GLFW_OPENGL_ANY_PROFILE to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE must be used. If OpenGL ES is requested, this hint is ignored.

这篇关于带有LWJGL的Mac OSX El Capitan上的OpenGL 3.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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