0
我是新來的遊戲製作和LWJGL,我想創建一個基本窗口。這裏是我的代碼:LWJGL:無法使用glfwCreateWindow創建窗口
if (!glfwInit()) {
System.out.println("Failed to initialize GLFW");
System.exit(1);
}
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
window = glfwCreateWindow(this.SCREEN_WIDTH, this.SCREEN_HEIGHT,
"Hello World", MemoryUtil.NULL, MemoryUtil.NULL);
if (window == MemoryUtil.NULL) {
System.out.println("Failed to create window");
System.exit(1);
}
glfwMakeContextCurrent(window);
GL.createCapabilities();
glfwSwapInterval(1);
但是,當我執行的代碼,我不斷收到:
Failed to create window
Process finished with exit code 1
我下面這個教程GitHub上:
可有人告訴我是什麼導致了這種情況發生。任何幫助,將不勝感激!