Skip to content

Commit 934f295

Browse files
committed
fix attributes article
1 parent 63b55d8 commit 934f295

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

webgl/lessons/ko/webgl-attributes.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,17 @@ gl.bindAttribLocation(program, 7, 'position');
132132
사용하는 경우가 드물기 때문에 위 설명에서 생략했는데요.
133133
134134
```js
135+
attributeValues: [
136+
[0, 0, 0, 1],
137+
[0, 0, 0, 1],
138+
...
139+
];
135140
attributes: [
136141
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
137-
 divisor: 0, value: [0, 0, 0, 1], },
142+
 divisor: 0, },
138143
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
139-
 divisor: 0, value: [0, 0, 0, 1], },
140-
..
144+
 divisor: 0, },
145+
...
141146
```
142147
143148
다양한 `gl.vertexAttribXXX` 함수로 각 속성의 값을 설정할 수 있습니다.

webgl/lessons/webgl-attributes.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,17 @@ Missing from the description above is that each attribute also has a default
138138
value. It is left out above because it is uncommon to use it.
139139
140140
```js
141+
attributeValues: [
142+
[0, 0, 0, 1],
143+
[0, 0, 0, 1],
144+
...
145+
];
141146
attributes: [
142147
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
143-
 divisor: 0, value: [0, 0, 0, 1], },
148+
 divisor: 0, },
144149
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
145-
 divisor: 0, value: [0, 0, 0, 1], },
146-
..
150+
 divisor: 0, },
151+
...
147152
```
148153
You can set each attribute's value with the various `gl.vertexAttribXXX`
149154
functions. The value is used when `enable` is false. When `enable` is true, data for
@@ -254,3 +259,8 @@ const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
254259
If you decide to use more than 8 you probably want to check how
255260
many are actually supported and inform the user if their
256261
machine doesn't have enough or else fallback to simpler shaders.
262+
263+
## State Diagram
264+
265+
If all of this is hard to follow this [state diagram](/webgl/lessons/resources/webgl-state-diagram.html)
266+
might help visualize what's happening.

webgl/lessons/zh_cn/webgl-attributes.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,17 @@ gl.bindAttribLocation(program, 7, 'position');
129129
上面没有提到的是,每个属性都有默认值。没有提到是因为通常不这么使用。
130130
131131
```js
132+
attributeValues: [
133+
[0, 0, 0, 1],
134+
[0, 0, 0, 1],
135+
...
136+
];
132137
attributes: [
133138
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
134-
 divisor: 0, value: [0, 0, 0, 1], },
139+
 divisor: 0, },
135140
{ enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ?,
136-
 divisor: 0, value: [0, 0, 0, 1], },
137-
..
141+
 divisor: 0, },
142+
...
138143
```
139144
140145
可以通过各个 `gl.vertexAttribXXX` 函数来设置每个属性的值。当 `enable` 为 false 时,该值被使用。

0 commit comments

Comments
 (0)