04-lighting/scripts/demo04-02.js
/**
 * Entry point of the application.
 */
Entry point of the application.
Entry point of the application .
function main() {
    var c = document.getElementById('c');
    c.width = c.clientWidth;
    c.height = c.clientHeight;
    gl = WebGLUtils.setupWebGL( c );
    if(!gl) {
        return;
    }
    window.onkeydown = function( event ) {
        if( event.keyCode == 32 ) {
            drawState += 1;
            drawState = drawState % 4;
        }
    }
    init();
    requestId = requestAnimFrame( update );
}
function main ( ) { var c = document . getElementById ( 'c' ) ; c . width = c . clientWidth ; c . height = c . clientHeight ; gl = WebGLUtils . setupWebGL ( c ) ; if ( ! gl ) { return ; } window . onkeydown = function ( event ) { if ( event . keyCode == 32 ) { drawState += 1 ; drawState = drawState % 4 ; } } init ( ) ; requestId = requestAnimFrame ( update ) ; }
Entry point of the application.
Entry point of the application .
// Get the WebGL canvas, and initialize WebGL // Escape on any error // Add a simple key listeners to toggle between skin drawing,  // normal map drawing, and light intensity drawing // If 'space' is pressed, cycle through drawing states: //  0 -- Draw Color map with lighting using the normal map //  1 -- Draw Color map without lighting //  2 -- Draw Normal map (no lighting) //  3 -- Draw light intensity  // Initialize all variables and display the scene // Draw the scene