hushaojie04 / libgdx

Automatically exported from code.google.com/p/libgdx
0 stars 0 forks source link

Setting Shader in SpriteBatch != Passing shader in Spritebach's builder #1114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Without using pedantic

if you use: batch = new SpriteBatch(1000,shaderProgram);

it throws :

 java.lang.IllegalArgumentException: no uniform with name 'u_proj' in shader

if you use: batch = new SpriteBatch(); batch.setShader(shader);

it needs uniform mat4 u_projectionViewMatrix; def

It wouldn't must be the same for both?

Original issue reported on code.google.com by angelusi...@gmail.com on 3 Nov 2012 at 2:43

GoogleCodeExporter commented 9 years ago
Wow, that's nasty. Fixed by making the default/internal shader use the same 
uniform (u_projTrans) than the custom shader.

I also removed setting the superfluous uniforms in case of a custom shader.

Original comment by badlogicgames on 4 Nov 2012 at 1:10