enableAttributeAndDivisor method

void enableAttributeAndDivisor(
  1. int attribute,
  2. int meshPerAttribute
)

Implementation

void enableAttributeAndDivisor(int attribute, int meshPerAttribute) {
  final newAttributes = currentState["newAttributes"];
  final enabledAttributes = currentState["enabledAttributes"];
  final attributeDivisors = currentState["attributeDivisors"];

  newAttributes[attribute] = 1;

  if (enabledAttributes[attribute] == 0) {
    gl.enableVertexAttribArray(attribute);
    enabledAttributes[attribute] = 1;
  }

  if (attributeDivisors[attribute] != meshPerAttribute) {
    gl.vertexAttribDivisor(attribute, meshPerAttribute);
    attributeDivisors[attribute] = meshPerAttribute;
  }
}