public void setVertexAttribute (int location, int size, int type, boolean normalize, int stride, Buffer buffer) { GL20 gl = Gdx.gl20; checkManaged(); gl.glVertexAttribPointer(location, size, type, normalize, stride, buffer); }
public void enableVertexAttribute (int location) { GL20 gl = Gdx.gl20; checkManaged(); gl.glEnableVertexAttribArray(location); }
public void setUniformi (int location, int value1, int value2, int value3, int value4) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform4i(location, value1, value2, value3, value4); }
public void setUniformf (int location, float value1, float value2, float value3) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform3f(location, value1, value2, value3); }
public void setVertexAttribute (int location, int size, int type, boolean normalize, int stride, int offset) { GL20 gl = Gdx.gl20; checkManaged(); gl.glVertexAttribPointer(location, size, type, normalize, stride, offset); }
public void disableVertexAttribute (int location) { GL20 gl = Gdx.gl20; checkManaged(); gl.glDisableVertexAttribArray(location); }
public void setUniformi (int location, int value1, int value2, int value3) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform3i(location, value1, value2, value3); }
public void setUniformf (int location, float value) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform1f(location, value); }
public void setUniform1fv (int location, float[] values, int offset, int length) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform1fv(location, length, values, offset); }
public void setUniform4fv (int location, float[] values, int offset, int length) { GL20 gl = Gdx.gl20; checkManaged(); gl.glUniform4fv(location, length / 4, values, offset); }
/** Makes OpenGL ES 2.0 use this vertex and fragment shader pair. When you are done with this shader you have to call * {@link ShaderProgram#end()}. */ public void begin () { GL20 gl = Gdx.gl20; checkManaged(); gl.glUseProgram(program); }
/** Sets an array of uniform matrices with the given name. The {@link ShaderProgram} must be bound for this to work. * * @param name the name of the uniform * @param buffer buffer containing the matrix data * @param transpose whether the uniform matrix should be transposed */ public void setUniformMatrix3fv (String name, FloatBuffer buffer, int count, boolean transpose) { GL20 gl = Gdx.gl20; checkManaged(); buffer.position(0); int location = fetchUniformLocation(name); gl.glUniformMatrix3fv(location, count, transpose, buffer); }
public void setUniform3fv (String name, float[] values, int offset, int length) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform3fv(location, length / 3, values, offset); }
/** Disables the vertex attribute with the given name * * @param name the vertex attribute name */ public void disableVertexAttribute (String name) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchAttributeLocation(name); if (location == -1) return; gl.glDisableVertexAttribArray(location); }
/** Sets the uniform with the given name. The {@link ShaderProgram} must be bound for this to work. * * @param name the name of the uniform * @param value the value */ public void setUniformf (String name, float value) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform1f(location, value); }
public void setUniform2fv (String name, float[] values, int offset, int length) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform2fv(location, length / 2, values, offset); }
/** Sets the uniform with the given name. The {@link ShaderProgram} must be bound for this to work. * * @param name the name of the uniform * @param value1 the first value * @param value2 the second value */ public void setUniformi (String name, int value1, int value2) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform2i(location, value1, value2); }
/** Sets the uniform with the given name. The {@link ShaderProgram} must be bound for this to work. * * @param name the name of the uniform * @param value1 the first value * @param value2 the second value * @param value3 the third value */ public void setUniformf (String name, float value1, float value2, float value3) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform3f(location, value1, value2, value3); }
public void setUniform3fv (String name, float[] values, int offset, int length) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform3fv(location, length / 3, values, offset); }
/** Invalidates all shaders so the next time they are used new handles are generated * @param app */ public static void invalidateAllShaderPrograms (Application app) { if (Gdx.gl20 == null) return; Array<ShaderProgram> shaderArray = shaders.get(app); if (shaderArray == null) return; for (int i = 0; i < shaderArray.size; i++) { shaderArray.get(i).invalidated = true; shaderArray.get(i).checkManaged(); } }