drawBufferInfo static method
dynamic
drawBufferInfo(
- OpenGLContextES gl,
- BufferInfo bufferInfo, [
- dynamic type,
- dynamic count,
- dynamic offset,
Draws the buffer info.
glthe OpenGlES context.bufferInfothe object buffer info.typethe draw type. default value isgl.TRIANGLES.tycountpethe count value. default value is0.offsetthe offset value. default value is0.
Implementation
static drawBufferInfo(OpenGLContextES gl, BufferInfo bufferInfo, [type, count, offset]) {
// type = type == null ? gl.TRIANGLES : type;
type ??= gl.TRIANGLES;
var indices = bufferInfo.indices;
var elementType = bufferInfo.elementType;
// var numElements = count == null ? bufferInfo.numElements : count;
int numElements;
if (count == null) {
numElements = bufferInfo.numElements;
} else {
numElements = count;
}
offset ??= 0;
if (elementType != null || indices != null) {
int primitiveType = type;
int _count = numElements;
int _type = elementType == null ? gl.UNSIGNED_SHORT : bufferInfo.elementType;
int _offset = offset;
// 4, 3, 5123, 0
gl.drawElements(primitiveType, _count, _type, _offset);
} else {
gl.drawArrays(type, offset, numElements);
}
}