I'm using LibGDX to develop/render my game and when I start the game in windowed mode, then switch to full screen, the sprites look blurry. Importantly(?), starting the game in full screen then switching to windowed mode doesn't have this problem.

Here's a section of a screenshot starting off windowed:

enter image description here

And after switching to fullscreen, the (roughly) same section of the screen:

enter image description here

The sprites are loaded from a TextureAtlas using LibGDX's TexturePacker. They're rendered using a normal SpriteBatch with the default settings/shaders. These are my pack.json settings:

    "pot": true,
    "paddingX": 2,
    "paddingY": 2,
    "bleed": true,
    "edgePadding": true,
    "maxWidth": 4096,
    "maxHeight": 4096,
    "duplicatePadding": false,
    "filterMin": "MipMapLinearLinear",
    "filterMag": "Linear"

I wondered if the filterMin/Mag might be having some effect but trying different settings is giving the same results.

To switch between fullscreen and windowed, I'm using the following code:

public static void toggleFullscreen() {
    if (DisplaySettings.isGamefullscreen && Gdx.graphics.supportsDisplayModeChange()) {
        // Switch to windowed
        Gdx.graphics.setWindowedMode(DisplaySettings.windowedWidth, DisplaySettings.windowedHeight);
        DisplaySettings.isGamefullscreen = false;
    } else if (Gdx.graphics.supportsDisplayModeChange()) {
        // Switch to full screen
        Gdx.graphics.setWindowedMode(DisplaySettings.desktopWidth, DisplaySettings.desktopHeight);
        DisplaySettings.isGamefullscreen = true;

So in this case the game starts off windowed then toggles to fullscreen after everything has loaded/been set up.

I am using some FrameBuffers and TextureRegions to draw to, but these are disposed and recreated on a resize.

I feel like there's some problems perhaps with the mipmaps being created and used incorrectly in this case but I'm a bit stuck at this point, any help much appreciated!


The problem is that you started the game with a specific resolution Width x Height. Next you tell you application to render that on the fullscreen, so it is taking that rendering and upscaling it, which causes you rendering to look blurry.

What you have to do is to call this first in your function: Gdx.graphics.setDisplayMode(x_width, y_width, DisplaySettings.isGamefullscreen), where x_width and y_width is the size you actually want the image rendered in (not upscaled to).

Then you might also have to send the new x_width and y_width to the camera, including updating the camera.

Hope that helps you.

  • \$\begingroup\$ That does help, thank you. Is there a way to set this scaling after the game has started, or will I always have to start at the desktop/monitor resolution and then scale down from there? \$\endgroup\$ – Ross Taylor-Turner Mar 13 '17 at 20:56
  • \$\begingroup\$ Keep in mind I am not used to libGDX, I did just recongnize the problem. It seems to that you have to call Gdx.graphics.setDisplayMode(x_width, y_width, DisplaySettings.isGamefullscreen) before calling setWindowedMode (in your posted function). Possibly even uptading the camera with new width and height. There is also one possibility that your textures are too low resolution, in which case there is not much to do about it other than getting higher resolution textures. \$\endgroup\$ – walkingBird Mar 14 '17 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.