Is it possible to disable frame-limiting in libGDX?

时光怂恿深爱的人放手 提交于 2019-12-04 16:27:54

问题


More specifically, a desktop libGDX-LWJGL application. There are configurations options to disable CPU syncing as well as vsynching, but regardless the application runs at 60fps.

This is fine for all practical uses - but out of curiousity if nothing else, I'd like to see how high the framerate could go.


回答1:


Rode Hyde's answer is no longer correct due to changes in the library. Try this:

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.vSyncEnabled = false; // Setting to false disables vertical sync
config.foregroundFPS = 0; // Setting to 0 disables foreground fps throttling
config.backgroundFPS = 0; // Setting to 0 disables background fps throttling

Also, make sure any hardware vsync is off on your GPU, if possible, as @RodHyde mentioned.




回答2:


The answer depends very much on the speed of your CPU and graphics card, but if you try a configuration like the following when you create your application, and disable vsync on your graphics card, then that should push it pretty hard.

LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "Framerate test";
cfg.width = 1280;
cfg.height = 720;
cfg.fullscreen = false;  
cfg.useGL20 = false;
cfg.useCPUSynch = false;
cfg.forceExit = true;  
cfg.vSyncEnabled = false;

Disabling vsync will be somewhere in the settings for your graphics card. On my nVidia card, it is given as "Vertical sync" in the options. It was set to "Adaptive", capping the frame rate at 60fps, but after setting it to "Off", I saw > 4000fps as measured by fraps.




回答3:


cfg.useCPUSynch has been taken out it seems. Setting cfg.foregroundFPS to some large number instead did the trick for me.



来源:https://stackoverflow.com/questions/15097834/is-it-possible-to-disable-frame-limiting-in-libgdx

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