Reputation: 13
I'm using LibGDX for game development in Java.
I've done extensive searching on Google to find a solution to the problem, but what I've found is that most people actually don't have their game locked and want it locked.
Here's the configuration code I'm using
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
...
config.width = 960;
config.height = 768;
config.backgroundFPS = 60;
config.foregroundFPS = 60;
config.vSyncEnabled = false;
...
I also tried setting backgroundFPS
and foregroundFPS
to 0.
If I set it to 20 it actually limits the game to 20fps. Is there any solution to this?
I know it's not doing too much work, because I tested the game loop with nothing but the framerate logger and it still sticks to 30.
Upvotes: 1
Views: 1116
Reputation: 13
I tested the program on somebody else's computer and it ran at 60fps without any trouble.
It turns out my computer was using integrated graphics instead of my high performance graphics card. After forcing Java to use the graphics card it now runs at 60fps.
Upvotes: 0
Reputation: 871
-1. If you are using fpsLogger, try using the code in step 2 or Fraps.
0. Disable Vsync or enable it.
1. Fraps can be problematic sometimes, in case you are using it. It occasionally shows me 30 fps when it is not.
2. Print Gdx.graphics.getDeltaTime()
to find out your real fps.
3. Don't set backgroundFPS and foregroundFPS.
4. Make sure you are not using Thread.sleep()
function. You might put it before and forgot about it.
5. Reboot your computer. If you really cannot find the source of the problem, this might help. Maybe your computer is tired or there is a problem with graphics driver.
6. Try it on another system. This problem might be caused by your setup.
7. To see if the problem is in your computer or your project, make a fresh project and measure its fps.
Upvotes: 2