-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
54 lines (38 loc) · 1.27 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: "WebGLRenderingContext: bindAttribLocation() method"
short-title: bindAttribLocation()
slug: Web/API/WebGLRenderingContext/bindAttribLocation
page-type: web-api-instance-method
browser-compat: api.WebGLRenderingContext.bindAttribLocation
---
{{APIRef("WebGL")}}
The **`WebGLRenderingContext.bindAttribLocation()`** method of
the [WebGL API](/en-US/docs/Web/API/WebGL_API) binds a generic vertex index
to an attribute variable.
## Syntax
```js-nolint
bindAttribLocation(program, index, name)
```
### Parameters
- `program`
- : A {{domxref("WebGLProgram")}} object to bind.
- `index`
- : A {{domxref("WebGL_API/Types", "GLuint")}} specifying the index of the generic vertex to bind.
- `name`
- : A string specifying the name of the variable to bind to the
generic vertex index. This name cannot start with `"webgl_"` or `"_webgl_"`, as these are
reserved for use by WebGL.
### Return value
None ({{jsxref("undefined")}}).
## Examples
```js
gl.bindAttribLocation(program, colorLocation, "vColor");
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("WebGLRenderingContext.getActiveAttrib()")}}
- {{domxref("WebGLRenderingContext.getAttribLocation()")}}
- {{domxref("WebGLRenderingContext.getVertexAttrib()")}}