LWJGL全屏无法正常工作 [英] LWJGL Fullscreen not working

查看:72
本文介绍了LWJGL全屏无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向程序添加全屏功能,但是无法正常工作.我正在尝试

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?

推荐答案

根据我的经验,DisplayMode需要支持它.您可以尝试以下方法:

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];
               }
         }

完成此操作后,您的Display.setFullscreen(true)应该可以工作

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

这篇关于LWJGL全屏无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆