use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniform3fv.
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);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method fetchAttributeLocation.
private int fetchAttributeLocation(String name) {
GL20 gl = Gdx.gl20;
// -2 == not yet cached
// -1 == cached but not found
int location;
if ((location = attributes.get(name, -2)) == -2) {
location = gl.glGetAttribLocation(program, name);
attributes.put(name, location);
}
return location;
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method end.
/** Disables this shader. Must be called when one is done with the shader. Don't mix it with dispose, that will release the
* shader resources. */
public void end() {
GL20 gl = Gdx.gl20;
gl.glUseProgram(0);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniform1fv.
public void setUniform1fv(int location, float[] values, int offset, int length) {
GL20 gl = Gdx.gl20;
checkManaged();
gl.glUniform1fv(location, length, values, offset);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method linkProgram.
private int linkProgram(int program) {
GL20 gl = Gdx.gl20;
if (program == -1)
return -1;
gl.glAttachShader(program, vertexShaderHandle);
gl.glAttachShader(program, fragmentShaderHandle);
gl.glLinkProgram(program);
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intbuf = tmp.asIntBuffer();
gl.glGetProgramiv(program, GL20.GL_LINK_STATUS, intbuf);
int linked = intbuf.get(0);
if (linked == 0) {
// Gdx.gl20.glGetProgramiv(program, GL20.GL_INFO_LOG_LENGTH, intbuf);
// int infoLogLength = intbuf.get(0);
// if (infoLogLength > 1) {
log = Gdx.gl20.glGetProgramInfoLog(program);
// }
return -1;
}
return program;
}
Aggregations