You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: webgl/lessons/webgl-environment-maps.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Here's an environment map from the lobby of the Computer History Museum in Mount
24
24
25
25
Based on [the code in the previous article](webgl-cube-maps.html) let's load those 6 images instead of the images we generated
26
26
27
-
```
27
+
```js
28
28
// Create a texture.
29
29
var texture =gl.createTexture();
30
30
gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
@@ -154,7 +154,7 @@ Now that we know how reflection works and that we can use it to look up values f
154
154
155
155
First in the vertex shader we'll compute the world position and world oriented normal of the vertices and pass those to the fragment shader as varyings. This is similar to what we did in [the article on spotlights](webgl-3d-lighting-spot.html).
156
156
157
-
```
157
+
```glsl
158
158
attribute vec4 a_position;
159
159
attribute vec3 a_normal;
160
160
@@ -181,7 +181,7 @@ Then in the fragment shader we normalize the worldNormal since it's being interp
181
181
182
182
And finally we use `reflect` which is a built in GLSL function that implements the formula we went over above. We use the result to get a color from the cubemap.
183
183
184
-
```
184
+
```glsl
185
185
precision highp float;
186
186
187
187
// Passed in from the vertex shader.
@@ -207,7 +207,7 @@ We also need real normals for this example. We need real normals so the faces of
207
207
208
208
At init time
209
209
210
-
```
210
+
```js
211
211
// Create a buffer to put normals in
212
212
var normalBuffer =gl.createBuffer();
213
213
// Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = normalBuffer)
0 commit comments