java - libgdx texture filters and mipmap -
when try use mipmap filtering in libgdx, none of images appear.
i'm new libgdx, , have simple 2d scene 3 rotating, scaled circles. in order anti-alias them, wanted use linear filtering. advice, looked this article,which said that, heavily scaled images, mipmap can used improve speed or quality.
the first unexpected appearance that, despite fact of images scaled down, see linear filter if magfilter linear. in other words:
this code show linear filter minified images:
parenttexture.setfilter(texturefilter.nearest, texturefilter.linear);
whlie code not:
parenttexture.setfilter(texturefilter.linear, texturefilter.nearest);
which seems opposite libgdx function:
void com.badlogic.gdx.graphics.texture.setfilter(texturefilter minfilter, texturefilter magfilter)
this not bother me, except indicates either libgdx wrong (unlikely), article wrong (unlikely), or don't understand texture filters. latter seems when try mipmap filters.
this code causes nothing display
parenttexture.setfilter(texturefilter.mipmaplinearlinear, texturefilter.linear);
this code displays, nearest filtering
parenttexture.setfilter(texturefilter.linear, texturefilter.mipmaplinearlinear);
any explanation of i'm wrong appreciated. have searched elsewhere, texture filters in libgdx pretty specific, aside article, haven't found help.
i had same problem, , fix turned out insanely simple. when create texture
, need specify uses mipmaps.
all have pass second parameter texture
constructor this:
texture mytexture = new texture(gdx.files.internal("myimage.png"), true);
you can view texture
class constructors in api docs here: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/texture.html
Comments
Post a Comment