0

我在使用 lwjgl 打开显示器时遇到问题。这在我升级到 Windows 10 之前有效。(我之前有 Windows 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

4

1 回答 1

1

尝试使用它:

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上已过时。请尝试升级您的驱动程序。(您可以在按 后键入 dxdiag 来查看您的驱动程序windows + R

于 2016-01-11T05:30:15.783 回答