@Override
public void drawTrianglesWithTextureColored(TextureHandle textureid, GeometryHandle shapeHandle, GeometryHandle colorHandle, int offset, int lines, int width, int stride, float x, float y) {
bindTexture(textureid);
if(backgroundVAO == -1) {
if(glcaps.GL_ARB_vertex_array_object) {
backgroundVAO = ARBVertexArrayObject.glGenVertexArrays();
bindFormat(backgroundVAO);
}
GL20.glEnableVertexAttribArray(0);
GL20.glEnableVertexAttribArray(1);
GL20.glEnableVertexAttribArray(2);
bindGeometry(shapeHandle);
GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 5 * 4, 0);
GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 5 * 4, 3 * 4);
bindGeometry(colorHandle);
GL20.glVertexAttribPointer(2, 1, GL11.GL_FLOAT, false, 0, 0);
setObjectLabel(GL11.GL_VERTEX_ARRAY, backgroundVAO, "background-vao");
setObjectLabel(KHRDebug.GL_BUFFER, shapeHandle.getInternalId(), "background-shape");
setObjectLabel(KHRDebug.GL_BUFFER, colorHandle.getInternalId(), "background-color");
}
int starti = offset < 0 ? (int)Math.ceil(-offset/(float)stride) : 0;
useProgram(prog_background);
GL20.glUniform2f(prog_background.ufs[TRANS], x, y);
bindFormat(backgroundVAO);
for (int i = starti; i != lines; i++) {
GL11.glDrawArrays(GL11.GL_TRIANGLES, (offset + stride * i) * 3, width * 3);
}
}
private static final int PROJ = 0;