java - LibGDX basic stage draw error -
i'm trying create game, code keeps giving me error:
exception in thread "lwjgl application" java.lang.illegalargumentexception: no uniform name 'u_projmodelview' in shader @ com.badlogic.gdx.graphics.glutils.shaderprogram.fetchuniformlocation(shaderprogram.java:287) @ com.badlogic.gdx.graphics.glutils.shaderprogram.fetchuniformlocation(shaderprogram.java:277) @ com.badlogic.gdx.graphics.glutils.shaderprogram.setuniformmatrix(shaderprogram.java:507) @ com.badlogic.gdx.graphics.glutils.shaderprogram.setuniformmatrix(shaderprogram.java:498) @ com.badlogic.gdx.graphics.glutils.immediatemoderenderer20.flush(immediatemoderenderer20.java:147) @ com.badlogic.gdx.graphics.glutils.immediatemoderenderer20.end(immediatemoderenderer20.java:160) @ com.badlogic.gdx.graphics.glutils.shaperenderer.end(shaperenderer.java:1104) @ com.badlogic.gdx.graphics.glutils.shaperenderer.check(shaperenderer.java:1092) @ com.badlogic.gdx.graphics.glutils.shaperenderer.rect(shaperenderer.java:389) @ com.badlogic.gdx.scenes.scene2d.ui.table.drawdebugrects(table.java:1224) @ com.badlogic.gdx.scenes.scene2d.ui.table.drawdebug(table.java:1204) @ com.badlogic.gdx.scenes.scene2d.group.drawdebugchildren(group.java:156) @ com.badlogic.gdx.scenes.scene2d.group.drawdebug(group.java:139) @ com.badlogic.gdx.scenes.scene2d.stage.drawdebug(stage.java:169) @ com.badlogic.gdx.scenes.scene2d.stage.draw(stage.java:132) @ net.lukshe.lukshegame2.screens.mainmenu.render(mainmenu.java:71) @ com.badlogic.gdx.game.render(game.java:46) @ net.lukshe.lukshegame2.lukshegame.render(lukshegame.java:23) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication.mainloop(lwjglapplication.java:215) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication$1.run(lwjglapplication.java:120)
mainmenu.java:
import com.badlogic.gdx.gdx; import com.badlogic.gdx.screen; import com.badlogic.gdx.graphics.color; import com.badlogic.gdx.graphics.gl30; import com.badlogic.gdx.graphics.g2d.bitmapfont; import com.badlogic.gdx.graphics.g2d.textureatlas; import com.badlogic.gdx.scenes.scene2d.stage; import com.badlogic.gdx.scenes.scene2d.ui.label; import com.badlogic.gdx.scenes.scene2d.ui.skin; import com.badlogic.gdx.scenes.scene2d.ui.table; import com.badlogic.gdx.scenes.scene2d.ui.textbutton; import com.badlogic.gdx.scenes.scene2d.ui.textbutton.textbuttonstyle; public class mainmenu implements screen { private stage stage; //done private textureatlas atlas; //done private skin skin; //done private table table; //done private textbutton buttonplay, buttonexit; private bitmapfont white; //done private label heading; @override public void show() { stage = new stage(); atlas = new textureatlas("ui/button.pack"); skin = new skin(atlas); table = new table(skin); table.setbounds(0, 0, gdx.graphics.getwidth(), gdx.graphics.getheight()); white = new bitmapfont(gdx.files.internal("font/white.fnt"), false); //set button style textbuttonstyle textbuttonstyle = new textbuttonstyle(); textbuttonstyle.up = skin.getdrawable("buttonup"); textbuttonstyle.down = skin.getdrawable("buttondown"); textbuttonstyle.pressedoffsetx = 1; textbuttonstyle.pressedoffsety = -1; textbuttonstyle.font = white; textbuttonstyle.fontcolor = color.black; //creating exit button buttonexit = new textbutton("exit", textbuttonstyle); buttonexit.pad(20); //add button table table.add(buttonexit); //debug table.debug(); //add table stage stage.addactor(table); } @override public void render(float delta) { //opengl settings gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl30.gl_color_buffer_bit); //render @ speed of delta stage.act(delta); //draw stage stage.draw(); }
lukshegame.java:
public class lukshegame extends game { public static final string name = "lukse game (libgdx)", version = "pre-alpha 0.0.0.2"; @override public void create() { setscreen(new splash()); } @override public void dispose() { super.dispose(); } @override public void render() { super.render(); } @override public void resize(int width, int height) { super.resize(width, height); } @override public void pause() { super.pause(); } @override public void resume() { super.resume(); }
}
if can me, please help.
edit: mainmenu.java called splash.java. in splash class i'm using tween engine increase , decrease opacity of splash screen. splash.java:
public class splash implements screen { private spritebatch batch; private sprite splash; private tweenmanager twm; @override public void show() { batch = new spritebatch(); twm = new tweenmanager(); tween.registeraccessor(sprite.class, new spriteaccessor()); texture splashtexture = new texture(gdx.files.internal("images/splash.png")); splash = new sprite(splashtexture); splash.setsize(gdx.graphics.getwidth(), gdx.graphics.getheight()); tween.set(splash, spriteaccessor.alpha).target(0).start(twm); tween.to(splash, spriteaccessor.alpha, 2).target(1).repeatyoyo(1, 2).setcallback(new tweencallback() { @override public void onevent(int type, basetween<?> source) { ((game) gdx.app.getapplicationlistener()).setscreen(new mainmenu()); } }).start(twm); } @override public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl30.gl_color_buffer_bit); twm.update(delta); batch.begin(); splash.draw(batch); batch.end(); } @override public void resize(int width, int height) { } @override public void pause() { } @override public void resume() { } @override public void hide() { } @override public void dispose() { batch.dispose(); splash.gettexture().dispose(); }
}
Comments
Post a Comment