Libgdx problems frame rate (FPS) -
i having problems frame rate in libgdx, alguin enlighten me if i'm doing wrong, because not think normal, problem in question load tilemap , simple , if put highest resolution of 320 x 320, 800 x 600 drops 12 fps or so, hope explain pue groin not native language thanks.
public class mygdxgame extends applicationadapter { spritebatch batch; texture img; private orthogonaltiledmaprenderer bachtilemaprender; private orthographiccamera camera; private tiledmap map; private int[] background = new int[] {0}, foreground = new int[] {1}; @override public void create () { batch = new spritebatch(); img = new texture("badlogic.jpg"); map = new tmxmaploader().load("maps/untitled.tmx"); bachtilemaprender = new orthogonaltiledmaprenderer(map, 1/32f);//asignar mapa camera = new orthographiccamera(gdx.graphics.getwidth(),gdx.graphics.getheight()); camera.settoortho(false, 32, 32); //virtual dimensiones } @override public void render () { gdx.gl.glclearcolor(1, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); //batch.begin(); //batch.draw(img, 0, 0); //batch.end(); camera.update(); bachtilemaprender.setview(camera); bachtilemaprender.render(background); system.out.println("fps:"+gdx.graphics.getframespersecond()); }
}
320 x 320 frame rate 60 climbed window or use 800 x 600 drops rapidly
public class desktoplauncher { public static void main (string[] arg) { lwjglapplicationconfiguration config = new lwjglapplicationconfiguration(); config.width = 320; config.height = 320; new lwjglapplication(new mygdxgame(), config); }
} p.d: it's worth computer dual core 3000, in debian linux
untitled.tmx
<?xml version="1.0" encoding="utf-8"?> <map version="1.0" orientation="orthogonal" width="32" height="32" tilewidth="32" tileheight="32"> <tileset firstgid="1" name="prueba" tilewidth="32" tileheight="32"> <image source="title.png" width="384" height="128"/> </tileset> <layer name="capa de patrones 1" width="32" height="32"> <data encoding="base64" compression="zlib"> ejztwwejaaambkhr8f17rsdqcnvuvvxv1w8ar2wb </data> </layer> </map>
what if this?
//swap these lines map = new tmxmaploader().load("maps/untitled.tmx"); //first load map bachtilemaprender = new orthogonaltiledmaprenderer(map); //then use map camera.settoortho(false, 800, 600); //x, y, z using aspect ratio want. //gfx config config.width = 800; config.height = 600;
also, how many tiles rendering?
Comments
Post a Comment