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?
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.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With