drawBufferInfo static method
dynamic
drawBufferInfo(
- OpenGLContextES gl,
- BufferInfo bufferInfo, [
- dynamic mode,
- dynamic count,
- int offset = 0,
Draws the buffer info.
glthe OpenGlES context.bufferInfothe object buffer info.modethe draw type. default value isgl.TRIANGLES.countthe count value. default value is0.offsetthe offset value. default value is0.
Implementation
static drawBufferInfo(OpenGLContextES gl, BufferInfo bufferInfo, [mode, count, int offset = 0]) {
mode ??= gl.TRIANGLES;
count ??= bufferInfo.numElements;
var indices = bufferInfo.indices;
dynamic elementType = bufferInfo.elementType;
// glClearError(gl);
if (elementType != null || indices != null) {
int type = elementType == null ? gl.UNSIGNED_SHORT : bufferInfo.elementType;
// 4, 3, 5123, 0
// Draw ellements if you have an index buffer.
gl.drawElements(mode, count, type, offset);
} else {
// Draw arrays if you don't have an index buffer.
gl.drawArrays(mode, offset, count);
}
// glLogCall(gl);
}