Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mizok opened this issue Apr 20, 2022 · 2 comments

Comments

@mizok
Copy link

mizok commented Apr 20, 2022

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)?

@greggman
Copy link
Owner

I think it was probably my mistake to make that function public but if you want to make arrayName optional, or give it a default of "" that's fine with me.

@mizok
Copy link
Author

mizok commented Apr 22, 2022

@greggman sure, I will make a pull request for that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants