java - libgdx - error while trying to use ShapeRenderer -
i'm trying make fade in effect using shaperenderer code:
gdx.gl.glenable(gl20.gl_blend); gdx.gl20.glblendfunc(gl20.gl_alpha, gl20.gl_one_minus_src_alpha); //shaderprogram.pedantic = false; shaperenderer.setprojectionmatrix(stage.getcamera().combined); shaperenderer.begin(shaperenderer.shapetype.filled); shaperenderer.setcolor(new color(0,0,0,fadetimeelapsed/1.5f)); shaperenderer.rect(0,0,gdx.graphics.getwidth(),gdx.graphics.getheight()); shaperenderer.end(); gdx.gl20.gldisable(gl20.gl_blend);
i following exception:
fatal exception: glthread 2715 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) @ net.ukk.rpg.level.render(level.java:93) @ com.badlogic.gdx.game.render(game.java:46) @ com.badlogic.gdx.backends.android.androidgraphics.ondrawframe(androidgraphics.java:422) @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1542) @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1266)
btw shaderprogram.pedantic=false
, don't filled rectangle. in advance.
the problem was instantiating shaperenderer in thread. calling constructor in show()
method solved issue.
Comments
Post a Comment