Don't unbind shaders.

https://github.com/libgdx/libgdx/pull/5944
This commit is contained in:
NathanSweet 2020-03-11 11:30:24 +01:00
parent 06b532504d
commit fef881730d
2 changed files with 4 additions and 10 deletions

View File

@ -250,11 +250,9 @@ public class NormalMapTest extends ApplicationAdapter {
ShaderProgram.pedantic = false;
if (!program.isCompiled()) throw new IllegalArgumentException("Error compiling shader: " + program.getLog());
program.begin();
program.bind();
program.setUniformi("u_texture", 0);
program.setUniformi("u_normals", 1);
program.end();
return program;
}

View File

@ -118,7 +118,7 @@ public class TwoColorPolygonBatch implements PolygonBatch {
public void begin () {
if (drawing) throw new IllegalStateException("end must be called before begin.");
Gdx.gl.glDepthMask(false);
shader.begin();
shader.bind();
setupMatrices();
drawing = true;
}
@ -127,7 +127,6 @@ public class TwoColorPolygonBatch implements PolygonBatch {
public void end () {
if (!drawing) throw new IllegalStateException("begin must be called before end.");
if (vertexIndex > 0) flush();
shader.end();
Gdx.gl.glDepthMask(true);
if (isBlendingEnabled()) Gdx.gl.glDisable(GL20.GL_BLEND);
@ -1384,13 +1383,10 @@ public class TwoColorPolygonBatch implements PolygonBatch {
@Override
public void setShader (ShaderProgram newShader) {
if (shader == newShader) return;
if (drawing) {
flush();
shader.end();
}
if (drawing) flush();
shader = newShader == null ? defaultShader : newShader;
if (drawing) {
shader.begin();
shader.bind();
setupMatrices();
}
}