LibGDX SpriteBatch Multitexture possible?

Viewed 3195

I'm happily using the SpriteBatch class of the LibGDX Framework. My aim is to modify the representation of the sprite through a shader.

batch = new SpriteBatch(2, shaderProgram);

I copied the default shader from the SpriteBatch Class and added another uniform Sampler 2d

+ "uniform sampler2D u_Texture2;\n"//

Is there a working way to give the texture to the shader. Doing it like this, allways ends up in a ClearColor Screen.

batch.begin();
  texture2.bind(1);
  shaderProgram.setUniformi("u_Texture2", 1);
  batch.draw(spriteTexture,positions[0].x,positions[0].y);
  batch.draw(spriteTexture,positions[1].x,positions[1].y);
batch.end();

Each texture alone is working. Drawing manually with the help of the Mesh Class works as expected. So what can i do to use the convenience of SpriteBatch?

THX for Help

1 Answers
Related