Time for action – updating uniforms in real time
Open the file
ch3_Sphere_Goraud_Lambert.html
in your favorite HTML5 browser.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. TheupdateObjectColor
function receives the updates from the widgets and updates theuMaterialDiffuse
uniform.Light diffuse term: changes the uniform
uLightDiffuse
,