LWJGL Fullscreen not working

青春壹個敷衍的年華 提交于 2019-12-12 11:24:09

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/12090819/lwjgl-fullscreen-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!