drawBufferInfo static method
dynamic
drawBufferInfo(
- OpenGLContextES gl,
- BufferInfo bufferInfo, [
- dynamic mode,
- dynamic count,
- int offset = 0,
Draws the buffer info.
gl
the OpenGlES context.bufferInfo
the object buffer info.mode
the draw type. default value isgl.TRIANGLES
.count
the count value. default value is0
.offset
the 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);
}