java 找不到 LWJGL 显示类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27831498/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
LWJGL Display class can't be found
提问by CaffeineToCode
I have installed LWJGL into a Java project, and I can't import the Display class.
我已将 LWJGL 安装到 Java 项目中,但无法导入 Display 类。
import org.lwjgl.opengl.display;
Gives a cannot be resolved error.
给出无法解决的错误。
DisplayMode and other classes are also missing. I can not find any of them in the broswer.
DisplayMode 和其他类也丢失了。我在浏览器中找不到它们中的任何一个。
回答by javac
The old utility classes like Display, Keyboard, Mouse etc. have been removed in LWJGL3. The libary now uses GLFWfor window management, which is more complicated but said to have better performance and more features. Like with OpenGL methods, all glfw methods are static and found in the org.lwjgl.glfw.GLFW class.
LWJGL3 中删除了旧的实用程序类,如 Display、Keyboard、Mouse 等。库现在使用GLFW进行窗口管理,它更复杂,但据说具有更好的性能和更多功能。与 OpenGL 方法一样,所有 glfw 方法都是静态的,可以在 org.lwjgl.glfw.GLFW 类中找到。
Unfortunately, because LWJGL3 is still in development, there aren't many tutorials out there. You can find one (unfinished) here: https://github.com/SilverTiger/lwjgl3-tutorial/wiki. Alternatively you can also look through the documentation, which provides some examples.
不幸的是,因为 LWJGL3 仍在开发中,所以没有很多教程。你可以在这里找到一个(未完成的):https: //github.com/SilverTiger/lwjgl3-tutorial/wiki。或者,您也可以查看文档,其中提供了一些示例。
EDIT: As of March 2015, there is a new unofficial tutorial seriesthat provides a good introduction to LWJGL3.
编辑:截至 2015 年 3 月,有一个新的非官方教程系列,很好地介绍了 LWJGL3。
EDIT: As of September 2015, a migration guide from LWJGL2 to LWJGL3is in progress.
编辑:截至 2015 年 9 月,从 LWJGL2 到 LWJGL3的迁移指南正在进行中。
回答by Ubica
- Create a folder named
lwjgl
in your project folder - Copy
lwjgl.jar
,lwjgl_util.jar
andslick-util.jar
into that folder - Select all three files in that folder and right click them
- Select Build-Path --> Add to Build Path
- Check if your project now contains the classes you need...
lwjgl
在您的项目文件夹中创建一个文件夹- 复制
lwjgl.jar
,lwjgl_util.jar
并slick-util.jar
进入该文件夹 - 选择该文件夹中的所有三个文件并右键单击它们
- 选择构建路径 --> 添加到构建路径
- 检查您的项目现在是否包含您需要的类...
In case you can't start your program, then set the path to natives folder... https://stackoverflow.com/a/27433775/3615725
如果您无法启动程序,请将路径设置为 natives 文件夹... https://stackoverflow.com/a/27433775/3615725
Also it should be imported as import org.lwjgl.opengl.Display;
它也应该导入为 import org.lwjgl.opengl.Display;
EDIT: For LWJGL 3 try this http://www.lwjgl.org/guide
编辑:对于 LWJGL 3,试试这个http://www.lwjgl.org/guide