use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class VertexBufferObjectSubData method dispose.
/** Disposes of all resources this VertexBufferObject uses. */
@Override
public void dispose() {
GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
gl.glDeleteBuffer(bufferHandle);
bufferHandle = 0;
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniformMatrix.
public void setUniformMatrix(int location, Matrix3 matrix, boolean transpose) {
GL20 gl = Gdx.gl20;
checkManaged();
gl.glUniformMatrix3fv(location, 1, transpose, matrix.val, 0);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method createProgram.
protected int createProgram() {
GL20 gl = Gdx.gl20;
int program = gl.glCreateProgram();
return program != 0 ? program : -1;
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method loadShader.
private int loadShader(int type, String source) {
GL20 gl = Gdx.gl20;
IntBuffer intbuf = BufferUtils.newIntBuffer(1);
int shader = gl.glCreateShader(type);
if (shader == 0)
return -1;
gl.glShaderSource(shader, source);
gl.glCompileShader(shader);
gl.glGetShaderiv(shader, GL20.GL_COMPILE_STATUS, intbuf);
int compiled = intbuf.get(0);
if (compiled == 0) {
// gl.glGetShaderiv(shader, GL20.GL_INFO_LOG_LENGTH, intbuf);
// int infoLogLength = intbuf.get(0);
// if (infoLogLength > 1) {
String infoLog = gl.glGetShaderInfoLog(shader);
log += type == GL20.GL_VERTEX_SHADER ? "Vertex shader\n" : "Fragment shader:\n";
log += infoLog;
// }
return -1;
}
return shader;
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniformMatrix4fv.
/** 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 setUniformMatrix4fv(String name, FloatBuffer buffer, int count, boolean transpose) {
GL20 gl = Gdx.gl20;
checkManaged();
buffer.position(0);
int location = fetchUniformLocation(name);
gl.glUniformMatrix4fv(location, count, transpose, buffer);
}
Aggregations