我在lwjgl打开显示器时遇到问题。这在我升级到windows 10之前就起作用了。(我以前有窗户7)。
这是控制台的错误
org.lwjgl.LWJGLException: Pixel format not accelerated
at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:247)
at org.lwjgl.opengl.Display.createWindow(Display.java:306)
at org.lwjgl.opengl.Display.create(Display.java:848)
at org.lwjgl.opengl.Display.create(Display.java:797)
at com.asasse.game3d.renderengine.DisplayManager.createDisplay(DisplayManager.java:23)
at com.asasse.game3d.enginetester.MainGameLoop.main(MainGameLoop.java:22)
Exception in thread "main" java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at org.lwjgl.opengl.GL11.glViewport(GL11.java:3261)
at com.asasse.game3d.renderengine.DisplayManager.createDisplay(DisplayManager.java:31)
at com.asasse.game3d.enginetester.MainGameLoop.main(MainGameLoop.java:22)
如果我的项目代码导致错误
final ContextAttribs attribs = new ContextAttribs(3, 1).withForwardCompatible(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
} catch (final LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
宽度为1280,高度为720
尝试使用以下内容:
ContextAttribs attribs = new ContextAttribs(3,3)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.create(new PixelFormat(),attribs);
} catch (LWJGLException e) {
e.printStackTrace();
}
我的猜测是,您的版本太低,无法进行某些计算,因此引发了异常。
如果不起作用,则可能是您的图形驱动程序已过时适用于Windows 10。请尝试升级您的驱动程序。(按下windows + R
后,您可以通过键入dxdiag来查看驱动程序)