UNPKG

745 BJavaScriptView Raw
1import { mapSize } from './mapSize.mjs';
2import { mapType } from './mapType.mjs';
3
4function getAttributeData(program, gl) {
5 const attributes = {};
6 const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
7 for (let i = 0; i < totalAttributes; i++) {
8 const attribData = gl.getActiveAttrib(program, i);
9 if (attribData.name.startsWith("gl_")) {
10 continue;
11 }
12 const type = mapType(gl, attribData.type);
13 const data = {
14 type,
15 name: attribData.name,
16 size: mapSize(type),
17 location: gl.getAttribLocation(program, attribData.name)
18 };
19 attributes[attribData.name] = data;
20 }
21 return attributes;
22}
23
24export { getAttributeData };
25//# sourceMappingURL=getAttributeData.mjs.map