LWJGL 3.1.6 OpenGL 4.1在macOS High Sierra上崩溃 [英] LWJGL 3.1.6 OpenGL 4.1 crash on macOS High Sierra
问题描述
我在LWJGL主页上找到了示例代码的稍作修改的版本.它可以工作,但是使用旧版OpenGL版本 2.1
.如果我尝试使用
I have a slightly modified version of the sample code found on the main LWJGL page. It works but it uses legacy OpenGL version 2.1
. If I attempt to use the forward-compatible context described in GLFW doc, the version used is 4.1
(no matter what major/minor I hint), the window is created, but it crashes on the first call to glPushMatrix()
.
启用前向兼容性,如下所示:
Forward compatibility enabled like so:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
我在控制台中打印的一些信息:
Some info I print in the console:
LWJGL 3.1.6 build 14
OS name Mac OS X
OS version 10.13.4
OpenGL version 4.1 ATI-1.66.31
记录:
[LWJGL] A function that is not available in the current context was called.
Problematic frame:
C [liblwjgl.dylib+0x1c494]
从这里我不知道要寻找什么.该代码是否可以正常工作?还是我错过了一些仪式?许多资源已经过时,这使得解决问题变得更加困难.
From here I don't know what to look for. Should this code be working? Or am I missing some ceremony? Many resources are outdated, making it harder to figure things out.
推荐答案
glPushMatrix
是针对Core Profile上下文而非OpenGL<的函数.3.2.
glPushMatrix
is a function for not Core Profile context, but for OpenGL < 3.2.
如果要使用它(和其他核心功能),则需要一个 Compatibility 上下文,而不是一个 Forwardcompatible ,而不是一个核心配置文件.
If you want to use it (and other pre-core features) you need a Compatibility context, not a Forward compatible one, not a Core profile either.
GLFW
提示应该像这样,而不要求提供核心配置文件.
The GLFW
hints should be like these, without asking for a Core Profile.
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
很可能驱动程序将提供最高的可用版本,但也具有所有旧功能.
Likely the driver will give the highest available version, but with all of old features too.
这篇关于LWJGL 3.1.6 OpenGL 4.1在macOS High Sierra上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!