【问题标题】:Display issues LWJGL显示问题 LWJGL
【发布时间】:2012-10-14 15:31:08
【问题描述】:

我正在运行这个简单的代码来使用 lwjgl 在 eclipse 中显示一个窗口:

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

@SuppressWarnings("unused")
public class DisplayExample {

public void start() {
    try {
        Display.setDisplayMode(new DisplayMode(1920, 1080));
        Display.create();




    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }

    // init OpenGL here

    while (!Display.isCloseRequested()) {

        // render OpenGL here

        Display.update(); //flushes OpenGL pipeline and swaps back and front buffers. perhaps waits for v-sync.
    }

    Display.destroy();
}

public static void main(String[] argv) {
    DisplayExample displayExample = new DisplayExample();
    displayExample.start();
}
}

但是屏幕看起来像这样并且闪烁: http://tinypic.com/r/33upp2u/6 这是在mac上运行的,有什么想法吗?

【问题讨论】:

    标签: java eclipse opengl lwjgl


    【解决方案1】:

    您没有在更新显示之前清除屏幕。在// render OpenGL here 之前添加GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);。您还需要为此导入 org.lwjgl.opengl.GL11 类。

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 2017-12-15
      • 2013-06-30
      • 2014-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-06
      相关资源
      最近更新 更多