use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniformMatrix4fv.
public void setUniformMatrix4fv(int location, float[] values, int offset, int length) {
GL20 gl = Gdx.gl20;
checkManaged();
gl.glUniformMatrix4fv(location, length / 16, false, values, offset);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniform2fv.
public void setUniform2fv(int location, float[] values, int offset, int length) {
GL20 gl = Gdx.gl20;
checkManaged();
gl.glUniform2fv(location, length / 2, values, offset);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setVertexAttribute.
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);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class ShaderProgram method setUniformi.
public void setUniformi(int location, int value) {
GL20 gl = Gdx.gl20;
checkManaged();
gl.glUniform1i(location, value);
}
use of com.badlogic.gdx.graphics.GL20 in project libgdx by libgdx.
the class VertexBufferObject method bind.
@Override
public void bind(ShaderProgram shader, int[] locations) {
final GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, bufferHandle);
if (isDirty) {
byteBuffer.limit(buffer.limit() * 4);
gl.glBufferData(GL20.GL_ARRAY_BUFFER, byteBuffer.limit(), byteBuffer, usage);
isDirty = false;
}
final int numAttributes = attributes.size();
if (locations == null) {
for (int i = 0; i < numAttributes; i++) {
final VertexAttribute attribute = attributes.get(i);
final int location = shader.getAttributeLocation(attribute.alias);
if (location < 0)
continue;
shader.enableVertexAttribute(location);
shader.setVertexAttribute(location, attribute.numComponents, attribute.type, attribute.normalized, attributes.vertexSize, attribute.offset);
}
} else {
for (int i = 0; i < numAttributes; i++) {
final VertexAttribute attribute = attributes.get(i);
final int location = locations[i];
if (location < 0)
continue;
shader.enableVertexAttribute(location);
shader.setVertexAttribute(location, attribute.numComponents, attribute.type, attribute.normalized, attributes.vertexSize, attribute.offset);
}
}
isBound = true;
}
Aggregations