To draw a basic shape like a triangle using a predefined shader, vertex attribute layout, and a Matrix4 uniform, use the AG API.
Example of drawing a red triangle on a blue background:
ag.clear(Colors.BLUE)
ag.createVertexBuffer(floatArrayOf(
0f, 0f,
640f, 0f,
640f, 480f
)).use { vertices ->
ag.draw(
vertices,
program = DefaultShaders.PROGRAM_DEBUG_WITH_PROJ,
type = AGDrawType.TRIANGLES,
vertexLayout = DefaultShaders.LAYOUT_DEBUG,
vertexCount = 3,
uniforms = mapOf(
DefaultShaders.u_ProjMat to Matrix4().setToOrtho(0f, 0f, 640f, 480f, -1f, +1f)
)
)
}