java - NullPointerException on Render -
when try debug this, got nullpointerexception. don't it, must not been initialized correctly can't see what... thanks!
@override public void create() { texture.setenforcepotimages(false); camera = new orthographiccamera(virtual_width, virtual_height); camera.settoortho(true,virtual_width,virtual_height); batch = new spritebatch(); labyrinthe = new labyrinthe(2, virtual_width); labyrinthe.generer(); joueur = labyrinthe.getjoueur(); } @override public void dispose() { batch.dispose(); } @override public void render() { camera.position.set(joueur.getx(), joueur.gety(), 0); camera.update(); camera.apply(gdx.gl10); gdx.gl.glviewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height); gdx.gl.glclearcolor(1, 1, 1, 1); gdx.gl.glclear(gl10.gl_color_buffer_bit); batch.setprojectionmatrix(camera.combined); batch.begin(); dessinerlabyrinthe(); dessinerjoueur(); batch.end(); // exception on line }
edit : here exception :
08-24 09:22:02.413: w/dalvikvm(224): threadid=21: thread exiting uncaught exception (group=0x4001b188) 08-24 09:22:02.413: e/androidruntime(224): uncaught handler: thread glthread exiting due uncaught exception 08-24 09:22:02.480: e/androidruntime(224): java.lang.nullpointerexception 08-24 09:22:02.480: e/androidruntime(224): @ com.badlogic.gdx.graphics.g2d.spritebatch.rendermesh(spritebatch.java:1042) 08-24 09:22:02.480: e/androidruntime(224): @ com.badlogic.gdx.graphics.g2d.spritebatch.end(spritebatch.java:269) 08-24 09:22:02.480: e/androidruntime(224): @ com.me.crazymazes.crazymazes.render(crazymazes.java:60) 08-24 09:22:02.480: e/androidruntime(224): @ com.badlogic.gdx.backends.android.androidgraphics.ondrawframe(androidgraphics.java:452) 08-24 09:22:02.480: e/androidruntime(224): @ com.badlogic.gdx.backends.android.surfaceview.glsurfaceviewcupcake$glthread.guardedrun(glsurfaceviewcupcake.java:713) 08-24 09:22:02.480: e/androidruntime(224): @ com.badlogic.gdx.backends.android.surfaceview.glsurfaceviewcupcake$glthread.run(glsurfaceviewcupcake.java:646)
edit2: never mind forgot call function generates textures.... anyway
in public void create() add this,
renderer.render();
Comments
Post a Comment