Search code examples
javalwjgldisplay

Minimizing the Display in LWJGL


I am working on a game that uses LWJGL, and I need a way to minimize the Display with a method. Is there a way to do this?


Solution

  • The easiest way to do this is to embed the LWJGL into a JPanel, Canvas, or something of the like. Doing this will allow you full control of the way your OpenGL layer is resized, etc. You can even have your own little "OpenGL controls" if you want to start getting fancy with it. here and here are two good examples. The vital part of it is quite simply:

    Display.setParent(myAwtOrSwingControl);
    

    After this you can set:

    myFrame.setState ( Frame.ICONIFIED );
    

    To achieve the minimization that you're looking for.