#7846·libgdx

setAnisotropicFilter doesn't work on GWT

Author: Frosty-JCreated Aug 9, 2026Updated Aug 9, 2026

Describe the bug

I don't think this works in WebGL:

https://github.com/libgdx/libgdx/blob/81cdb92811403f148daff195bff1da896877824c/gdx/src/com/badlogic/gdx/graphics/GLTexture.java#L198-L210

https://github.com/libgdx/libgdx/blob/81cdb92811403f148daff195bff1da896877824c/gdx/src/com/badlogic/gdx/graphics/GLTexture.java#L217-L228

So for my project, I had AI write this workaround:

java
public static void setAnisotropicFilter(Texture texture, float level) {
  if (Gdx.app.getType() == Application.ApplicationType.WebGL) {
    boolean supported = Gdx.graphics.supportsExtension("EXT_texture_filter_anisotropic")
      || Gdx.graphics.supportsExtension("WEBKIT_EXT_texture_filter_anisotropic")
      || Gdx.graphics.supportsExtension("MOZ_EXT_texture_filter_anisotropic");

    if (supported) {
      texture.bind();
      Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAX_ANISOTROPY_EXT, level);
    }
  } else {
    texture.setAnisotropicFilter(level);
  }
}

I don't know if the WebKit/Moz prefixes are really necessary. I haven't put any brainpower into this, hence why this is just an issue and not a pull request that fixes it.

Reproduction

Render a mipmapped texture at a sharp angle. Try to do texture.setAnisotropicFilter(16f). You would expect it to look like this:

Image

But instead it looks like this (GWT):

Image

(camera angle is slightly different between these screenshots, but you get the picture)

version

1.14.2

Stack trace

bash

Affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS