Skip to content

Commit faf9272

Browse files
committed
typos
1 parent a3fa79d commit faf9272

3 files changed

+33
-31
lines changed

webgl/lessons/webgl-qna-can-anyone-explain-what-this-glsl-fragment-shader-is-doing-.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ As long as we convert the value to something from 0 to 1 we can see the result
131131

132132
for example going down to line 14
133133

134-
d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
134+
d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
135135

136136
Since we know it goes from 200 +/- 18 +/- 7 that's 175 + 225 so convert that to 0 to 1 with
137137

138-
d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
139-
float tmp = (d - 175.0) / 50.0;
140-
gl_FragColor = vec4(tmp, 0, 0, 1);
141-
return;
138+
d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
139+
float tmp = (d - 175.0) / 50.0;
140+
gl_FragColor = vec4(tmp, 0, 0, 1);
141+
return;
142142

143143
will give you some idea what it's doing.
144144

webgl/lessons/webgl-qna-drawing-2d-image-with-depth-map-to-achieve-pseudo-3d-effect.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Following the [image processing tutorials](https://webglfundamentals.org/webgl/l
4747

4848
First you need the original image
4949

50-
![original image](https://i.imgur.com/xKYRSwu.jpg)
50+
<div class="webgl_center"><img src="https://i.imgur.com/xKYRSwu.jpg" style="width: 600px;"></div>
5151

5252
and you then apply a sine wave distortion.
5353

5454
{{{example url="../webgl-qna-drawing-2d-image-with-depth-map-to-achieve-pseudo-3d-effect-example-1.html"}}}
5555

5656
Then they also load a texture of multiple maps. This texture was created by hand in photoshop (or other image editing program). The green channel is how much to multiply the distortion by. The greener the more distortion.
5757

58-
![](http://i.imgur.com/W9QazjL.jpg)
58+
<div class="webgl_center"><img src="http://i.imgur.com/W9QazjL.jpg" style="width: 600px;"></div>
5959

6060
{{{example url="../webgl-qna-drawing-2d-image-with-depth-map-to-achieve-pseudo-3d-effect-example-2.html"}}}
6161

@@ -65,7 +65,7 @@ Next there's an offset for the mouse multplied by another hand drawn map. This m
6565

6666
Finally, (not in the tutorial but in the sample) it loads a blurred version of the original image (blurred in some image editing program like photoshop)
6767

68-
![](http://i.imgur.com/Zw7mMLX.jpg)
68+
<div class="webgl_center"><img src="http://i.imgur.com/Zw7mMLX.jpg" style="width: 600px;"></div>
6969

7070
It might be hard to see it's blurred since the blurring is subtle.
7171

webgl/lessons/webgl-qna-glsl-shader-to-support-coloring-and-texturing.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ get location:
1414

1515
when drawing I change the value like this:
1616

17-
var uUseTexture=false;
18-
gl.uniform1f(shaderProgram.useTextureUniform, uUseTexture);
17+
var uUseTexture=false;
18+
gl.uniform1f(shaderProgram.useTextureUniform, uUseTexture);
19+
1920
And the GLSL itself:
2021

2122
fragment:
@@ -28,36 +29,37 @@ fragment:
2829
void main(void) {
2930
vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
3031
vec4 texColor = vec4(textureColor.rgb, textureColor.a);
31-
vec4 vertexColor = vColor;
32-
if (!uUseTexture){
33-
gl_FragColor = vertexColor;
34-
}
35-
else{
36-
gl_FragColor = texColor;
37-
}
32+
vec4 vertexColor = vColor;
33+
if (!uUseTexture){
34+
gl_FragColor = vertexColor;
35+
}
36+
else {
37+
gl_FragColor = texColor;
38+
}
3839
}
3940

4041
vertex:
4142

4243

43-
attribute vec3 aVertexPosition;
44-
attribute vec3 aVertexNormal;
45-
attribute vec2 aTextureCoord;
46-
attribute vec4 aVertexColor;
44+
attribute vec3 aVertexPosition;
45+
attribute vec3 aVertexNormal;
46+
attribute vec2 aTextureCoord;
47+
attribute vec4 aVertexColor;
4748
48-
uniform mat4 uMVMatrix;
49-
uniform mat4 uPMatrix;
50-
uniform mat3 uNMatrix;
49+
uniform mat4 uMVMatrix;
50+
uniform mat4 uPMatrix;
51+
uniform mat3 uNMatrix;
5152

52-
varying vec2 vTextureCoord;
53-
varying vec4 vColor;
53+
varying vec2 vTextureCoord;
54+
varying vec4 vColor;
5455
5556
56-
void main(void){
57-
vec4 mvPosition = uMVMatrix * vec4(aVertexPosition, 1.0);
58-
gl_Position = uPMatrix * mvPosition;
59-
vTextureCoord = aTextureCoord;
60-
vColor = aVertexColor;}
57+
void main(void) {
58+
vec4 mvPosition = uMVMatrix * vec4(aVertexPosition, 1.0);
59+
gl_Position = uPMatrix * mvPosition;
60+
vTextureCoord = aTextureCoord;
61+
vColor = aVertexColor;
62+
}
6163

6264
## Answer:
6365

0 commit comments

Comments
 (0)