java - LibGDX Big FreeType MipMapped font looks pixelated -
i've been developing game android on libgdx, , i've found problem seems no 1 had before. searched answers on how smooth text, , 2 things:
- use freetype fonts.
- use mipmap texture filter.
so, used freetype font, , applied mipmap, , i'm pretty sure filter scaling font down (so, using mipmap), since font of size 200 , real screen absolutely not big.
i don't know if i'm making kind of stupid mistake or something, can't figure out why happening, since did seems thing solves issue other people.
so, that's did:
i have assets class things want load, (forgetting sprites) looks this:
public static bitmapfont font; public static void load(){ freetypefontgenerator fontgen = new freetypefontgenerator(gdx.files.internal("vaques/opensans-bold.ttf")); //free font fontsquirrel.com freetypefontparameter fontpar = new freetypefontparameter(); fontpar.size = 200; fontpar.color = color.valueof("ffffff"); fontpar.genmipmaps = true; font = fontgen.generatefont(fontpar); font.getregion().gettexture().setfilter(texturefilter.mipmaplinearnearest, texturefilter.linear); fontgen.dispose(); } and then, load fonts on create() method in main class, , draw them on screen.java file. getting texty things looks this:
//outside constructor (variable declaration part): orthographiccamera textcam; viewport textport; spritebatch textbatch; //... //inside constructor: textbatch = new spritebatch(); textcam = new orthographiccamera(); textport = new extendviewport(1600,0,textcam); textport.apply(false); //... //on render() method: gdx.gl.glclearcolor(0.2f, 0.2f, 0.2f, 1f); gdx.gl.glclear(gl20.gl_color_buffer_bit); textcam.update(); textbatch.setprojectionmatrix(textcam.combined); textbatch.begin(); assets.font.setcolor(color.valueof("821201")); //whatever color assets.font.draw(textbatch,integer.tostring((int) (1/delta)), 80, 2400-40); textbatch.end(); //i draw more text, looks same one, in other colors. and here screenshot of text: it seems can't post images directly, here's link.
the image shows part of circle comming 1024x1024 png scaled down through mipmapping. looked text when drawing them through shaperenderer, fine.
any idea why happening?
is mac supporting freetype fonts mipmap texture filter. i'm little bit doubt on this. confirm.
Comments
Post a Comment