LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: nbilyk on March 23, 2015, 01:48:18

Title: LWJGL 3 - render after window restore
Post by: nbilyk on March 23, 2015, 01:48:18
If I'm making something with non-continuous rendering, how do I check if the display is dirty from something like minimizing and restoring?

There used to be org.lwjgl.opengl.Display.isDirty, but I don't know what the equivalent is in 3.
Title: Re: LWJGL 3 - render after window restore
Post by: SHC on March 23, 2015, 01:56:03
In GLFW you can set a Window Iconify callback, which is called when your window is iconified (minimized) and restored. You then will know when it will be dirty, or when it's not.


// The Callback function
private void glfwIconifyCallback(long window, int iconify)
{
    if (iconify == 0)
        // Handle restore event
    else
        // Handle minimized event
}

// Set the callback to the window
GLFWWindowIconifyCallback callback = GLFWWindowIconifyCallback(this::glfwIconifyCallback);
glfwSetWindowIconifyCallback(myWindow, callback);

That is how you specify the window iconify callback in GLFW. Don't forget to release this callback before destroying the window. Hope this helps.
Title: Re: LWJGL 3 - render after window restore
Post by: nbilyk on March 23, 2015, 03:21:22
 ;D Perfect, that worked, thanks!