orange451/LWJGUI

Correct rendering when resizing

Closed this issue · 2 comments

Rendering on resize does not behave as I expected.

    private void loop() {
        while (!glfwWindowShouldClose(window) ) {
            render();
            glfwPollEvents();
        }
    }
    glfwSetWindowSizeCallback(window, (handle, width, height) -> render());
    private void render() {
        WindowManager.update();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        lwjguiWindow.render();
        glfwSwapBuffers(window);
    }

resize-test

Not the correct usage, once a window is wrapped with LWJGUI you cannot use glfwSet*Callback calls, doing so will remove the custom callbacks used by the window. The correct way is to add your callback using window.getWindowSizeCallback.

Also should never call WindowManager.update from withing a callback due to GLFW limitations.

I see. It's woking great now. Thank you very much!