Skip to content

what is the parameter "arrayName" of createBufferFromArray for? could it be optional? #194

Open
@mizok

Description

@mizok

In the document the third parameter arrayName of createBufferFromArray is said to be string type, but is not mentioned why we are giving this parameter.

So I checked attribute.js and found that this parameter is used to definite another boolean isIndice.

function createBufferFromArray(gl, array, arrayName) {
  const type = arrayName === "indices" ? ELEMENT_ARRAY_BUFFER : ARRAY_BUFFER;
  const typedArray = makeTypedArray(array, arrayName);
  return createBufferFromTypedArray(gl, typedArray, type);
}

I am just wondering if this parameter will be better if we change it to boolean type and make it optional (to me it's easier to understand)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions