【发布时间】:2017-03-21 21:36:40
【问题描述】:
这只是代码的一小部分。我想知道为什么我的 Display 方法
不起作用,即使我使用的是 opengl 库并设置了
本机路径。
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
public class Window
{
public static void CreateWindow(int width, int height, String title)
{
Display.setTitle(title);
try
{
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Display cannot be resolved
Display cannot be resolved
DisplayMode cannot be resolved to a type
Display cannot be resolved
Keyboard cannot be resolved
Mouse cannot be resolved
LWJGLException cannot be resolved to a type
at com.base.engine.rendering.Window.CreateWindow(Window.java:14)
at com.base.engine.core.CoreEngine.CreateWindow(CoreEngine.java:27)
at com.base.game.Main.main(Main.java:10)
【问题讨论】:
-
可能是因为您使用的是 LWJGL 3,而这些类不存在任何东西。