Skip to content

Commit

Permalink
swap indices so triangles face the same direction
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 24, 2022
1 parent 47cc85f commit 4258b95
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions webgl/lessons/ko/webgl-instanced-drawing.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
0.4, -0.1,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
Expand Down
4 changes: 2 additions & 2 deletions webgl/lessons/webgl-instanced-drawing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
0.4, -0.1,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
Expand Down
14 changes: 12 additions & 2 deletions webgl/lessons/zh_cn/webgl-instanced-drawing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,18 @@ gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer)
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-0.1, 0.4, -0.1, -0.4, 0.1, -0.4, 0.1, -0.4, -0.1, 0.4, 0.1, 0.4, 0.4,
-0.1, -0.4, -0.1, -0.4, 0.1, -0.4, 0.1, 0.4, -0.1, 0.4, 0.1
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
0.4, 0.1,
]),
gl.STATIC_DRAW
)
Expand Down
4 changes: 2 additions & 2 deletions webgl/webgl-instanced-drawing-not-instanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
0.4, -0.1,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
Expand Down
4 changes: 2 additions & 2 deletions webgl/webgl-instanced-drawing-projection-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
0.4, -0.1,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
Expand Down
6 changes: 3 additions & 3 deletions webgl/webgl-instanced-drawing.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
-0.1, 0.4,
-0.1, -0.4,
0.1, -0.4,
0.1, -0.4,
-0.1, 0.4,
0.1, -0.4,
0.1, 0.4,
0.4, -0.1,
-0.4, -0.1,
0.4, -0.1,
-0.4, 0.1,
-0.4, 0.1,
0.4, -0.1,
Expand Down Expand Up @@ -170,7 +170,7 @@

// Tell WebGL how to convert from clip space to pixels
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);

gl.enable(gl.CULL_FACE);
gl.useProgram(program);

// setup all attributes
Expand Down

0 comments on commit 4258b95

Please sign in to comment.