全屏闪烁:LWJGL

时间:2018-12-15 19:38:09

标签: lwjgl

我已经看到有关渲染期间LWJGL窗口闪烁的问题,但是我在这里谈论的是全屏闪烁,而不仅仅是窗口。闪烁的时间约为正常计算机屏幕的1.5秒,然后为全黑的1.5秒。

我不是要全屏运行该应用程序。

我使用的是this tutorial中的代码,是我在Kotlin中重写的:

<h2>CSS Animations are
  <div class="animated">
    <span>cool.</span>
    <span>neat.</span>
    <span>awesome.</span>
    <span>groovy.</span>
    <span>magic.</span>

    <span>more.</span>
    <span>lorem.</span>
    <span>pixel.</span>
    <span>word.</span>
    <span>ten.</span>
  </div>
</h2>

具有Gradle依赖项:

fun main(args: Array<String>){
    SharedLibraryLoader.load()

    thread {
        Main.run()
    }
}

object Main: Runnable {

    val window: Long

    init {
        if (glfwInit() != GL_TRUE)
            throw RuntimeException("Couldn't initialize GLFW...")

        glfwWindowHint(GLFW_RESIZABLE, GL_TRUE)

        window = glfwCreateWindow(800, 600, "Test", NULL, NULL)
        if (window == NULL)
            throw RuntimeException("Couldn't create the window...")

        val videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor())
        glfwSetWindowPos(window, 100, 100)
        glfwMakeContextCurrent(window)
        glfwShowWindow(window)
    }

    fun update() {
        glfwPollEvents()
    }

    fun render() {
        glfwSwapBuffers(window)
    }

    override fun run() {
        while (glfwWindowShouldClose(window) != GL_TRUE){
            update()
            render()
        }
    }

}

我在Debian 9机器(Linux)上。这是显卡问题吗?还是代码只是错误的?

0 个答案:

没有答案