Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LWJGL Fullscreen not working

I'm trying to add fullscreen functionality to my program but I couldn't get it to work. I'm trying

Display.setFullscreen(true);

I tried changing its position to above where I create the display or where I set the displaymode, but still not working. Any help about this?

like image 397
Mertcan Ekiz Avatar asked Aug 23 '12 11:08

Mertcan Ekiz


People also ask

How do I make lwjgl3 games fullscreen?

Simply make any game using the LWJGL3 backend fullscreen, using either the Lwjgl3ApplicationConfiguration or Gdx.graphics.setFullscreenMode (mode). If you have multiple monitors, you can tell if the window is exclusive fullscreen based on whether or not it catches the mouse by default.

How to create a full screen window using glfwcreatewindow?

You can use glfwGetPrimaryMonitor () to get a monitor handle and pass it into glfwCreateWindow () as follows: As long as monitor param is not null, it will create full screen window on the monitor specified. This was done to support multiple monitors.

How can I tell if a window is exclusive fullscreen?

If you have multiple monitors, you can tell if the window is exclusive fullscreen based on whether or not it catches the mouse by default. 1.9.6, LWJGL3 backend.

What is the default behavior for setting a window to fullscreen?

Using the LWJGL2 backend, the default behavior for setting a window to fullscreen was to make the window "exclusive fullscreen." When in exclusive fullscreen mode, a window catches the mouse and typically gives better performance. In the LWJGL3 backend, the default behavior has changed.


2 Answers

From my experience the DisplayMode needs to support it. You can try this:

        DisplayMode displayMode = null;
        DisplayMode[] modes = Display.getAvailableDisplayModes();

         for (int i = 0; i < modes.length; i++)
         {
             if (modes[i].getWidth() == width
             && modes[i].getHeight() == height
             && modes[i].isFullscreenCapable())
               {
                    displayMode = modes[i];
               }
         }

After doing this your Display.setFullscreen(true) should work

like image 112
Mathew Fulton Avatar answered Nov 25 '22 16:11

Mathew Fulton


I know this question is quite (5 years) old, but there may still be people looking for a solution to this question.

The simplest way is to do:

Display.setDisplayModeAndFullscreen(Display.getDesktopDisplayMode());

Which will put your display in fullscreen for you. No need for setFullscreen() with this either.

like image 28
DestinySpork Avatar answered Nov 25 '22 16:11

DestinySpork