1
我正在使用LWJGL构建游戏。LWJGL不会创建GLFW_API_UNAVAILABLE错误的窗口
但有一个问题。当我调用glfwCreateWindow时,LWJGL抛出一个错误并且不会创建窗口。
这里是输出:
[2016-05-14 22:42:04.665] [CubeSystem/INFO] Starting graphics engine...
[LWJGL] GLFW_API_UNAVAILABLE error
Description : WGL: The driver does not appear to support OpenGL
Stacktrace :
org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:1168)
org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1251)
Tmk.MyAdventure.System.CubeSystem.Init(CubeSystem.java:37)
Tmk.MyAdventure.Main.main(Main.java:13)
[2016-05-14 22:42:04.740] [CubeSystem/ERROR] Cannot create window.
我不知道为什么它说,司机似乎并不支持OpenGL。
我的电脑运行OpenGL游戏很好。此外,我更新了驱动程序到最新版本,并仍显示此消息。
我在IDE之外运行时收到了相同的消息。
这里是代码:
....
public class CubeSystem {
private static Logger l = new Logger("CubeSystem");
private static final int DEFAULT_WIDTH = 640;
private static final int DEFAULT_HEIGHT = 480;
private long window;
public CubeSystem() {
}
public boolean Init() {
l.Info("Starting graphics engine...");
//Configure error stream
GLFWErrorCallback.createPrint(System.err).set();
if(glfwInit() != GL_TRUE) {
l.Err("Cannot initialize GLFW.");
return false;
}
//Configure window
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
window = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "My Adventure", NULL, NULL);
if(window == NULL) {
l.Err("Cannot create window.");
return false;
}
glfwDestroyWindow(window);
glfwTerminate();
glfwSetErrorCallback(null).release();
return true;
}
}
注:开始于init()方法。
你有正确链接的LWJGL当地人? – RecursiveExceptionException
'WGL:驱动程序似乎不支持OpenGL'。无论是在LWJGL中的错误,在这种情况下,你可以尝试不同的版本,或者你的电脑不喜欢GLFW – RecursiveExceptionException