-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
50 lines (34 loc) · 1.06 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
---
title: "WebGLRenderingContext: getAttribLocation() method"
short-title: getAttribLocation()
slug: Web/API/WebGLRenderingContext/getAttribLocation
page-type: web-api-instance-method
browser-compat: api.WebGLRenderingContext.getAttribLocation
---
{{APIRef("WebGL")}}
The **`WebGLRenderingContext.getAttribLocation()`** method of
the [WebGL API](/en-US/docs/Web/API/WebGL_API) returns the location of an
attribute variable in a given {{domxref("WebGLProgram")}}.
## Syntax
```js-nolint
getAttribLocation(program, name)
```
### Parameters
- `program`
- : A {{domxref("WebGLProgram")}} containing the attribute variable.
- `name`
- : A string specifying the name of the attribute variable whose
location to get.
### Return value
A {{domxref("WebGL_API/Types", "GLint")}} number indicating the location of the variable name if found.
Returns -1 otherwise.
## Examples
```js
gl.getAttribLocation(program, "vColor");
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("WebGLRenderingContext.getUniformLocation()")}}