From a181dd355675cfc5d1a8e3b1d001b9a77ec87b10 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Sun, 26 Sep 2021 18:28:48 -0700 Subject: [PATCH] README --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07fe420b..8cbb0fb4 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ twgl.setUniforms(progInfo, { { intensity: 5.0, shininess: 100, color: [1, 0, 0, 1] }, { intensity: 2.0, shininess: 50, color: [0, 0, 1, 1] }, ], -}) +}); ``` WebGL @@ -421,6 +421,16 @@ gl.uniform1f(light1ShininessLoc, 50); gl.uniform4fv(light1ColorLoc, [0, 0, 1, 1]); ``` +If you just want to set the 2nd light in TWGL you can do this + +```javascript +const progInfo = twgl.createProgramInfo(gl, [vs, fs]); +... +twgl.setUniforms(progInfo, { + lights[1]: { intensity: 5.0, shininess: 100, color: [1, 0, 0, 1] }, +}); +``` + ### Compare [TWGL example](http://twgljs.org/examples/twgl-cube.html) vs [WebGL example](http://twgljs.org/examples/webgl-cube.html)