O'Reilly logo

WebGL Beginner's Guide by Brandon Jones, Diego Cantor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — updating uniforms in real time

  1. Open the file ch3_Sphere_Goraud_Lambert.html in your favorite HTML5 browser.
  2. You will see that this example has some widgets at the bottom of the page. These widgets were created using JQuery UI. You can check the code for those in the HTML<body> of the page.
    • X,Y,Z: controls the direction of the light. By changing these sliders you will modify the uniform uLightDirection.
    • Sphere color: changes the uniform uMaterialDiffuse, which represents the diffuse color of the sphere. Here we use a color selection widget so you can try different colors. The updateObjectColor function receives the updates from the widgets and updates the uMaterialDiffuse uniform.
    • Light diffuse term: changes the uniform uLightDiffuse ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required