Source

WebGL Beginner's Guide - Code / 1727_09 / ch9_Scaffolding.html

<html>

<head>
<title>WebGL Beginner's Guide - Chapter 9 - Car Show Room</title>
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>
<link href='css/styles.css'   type='text/css' rel='stylesheet'>
<link href='css/cars.css' type='text/css' rel='stylesheet' />
<link href='css/smoothness/jquery-ui-1.8.13.custom.css' type='text/css' rel='stylesheet' />
<!-- GUI Libraries //-->
<script type='text/javascript' src='js/gui/jquery-1.5.1.min.js'></script>
<script type='text/javascript' src='js/gui/jquery-ui-1.8.13.custom.min.js'></script> 

<!-- MATH Libraries //-->
<script type='text/javascript' src='js/math/gl-matrix-min.js'></script>
<!-- WEBGL Libraries //-->
<script type='text/javascript' src='js/webgl/Globals.js'></script>
<script type='text/javascript' src='js/webgl/Utils.js'></script>
<script type='text/javascript' src='js/webgl/Program.js'></script>
<script type='text/javascript' src='js/webgl/Scene.js'></script>
<script type='text/javascript' src='js/webgl/Axis.js'></script>
<script type='text/javascript' src='js/webgl/Floor.js'></script>
<script type='text/javascript' src='js/webgl/Camera.js'></script>
<script type='text/javascript' src='js/webgl/CameraInteractor.js'></script>
<script type='text/javascript' src='js/webgl/SceneTransforms.js'></script>
<script type='text/javascript' src='js/webgl/Texture.js'></script>
<script type='text/javascript' src='js/webgl/WebGLApp.js'></script>
<script type='text/javascript' src='js/webgl/Picker.js'></script>
<script type="text/javascript">


function configure(){
    gl.clearColor(0.3,0.3,0.3, 1.0);
    gl.clearDepth(100.0);
    gl.enable(gl.DEPTH_TEST);
    gl.depthFunc(gl.LESS);
	gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA);
}

function load(){

}

function render(){
    gl.viewport(0, 0, c_width, c_height);
    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
}


function resizeCanvas(){
    c_width = $('#content').width();
    c_height = $('#content').height();
    $('#the-canvas').attr('width',c_width);
    $('#the-canvas').attr('height',c_height);
}

$(window).resize(function(){resizeCanvas();});


var app = undefined;
function runShowRoom(){
    app = new WebGLApp("the-canvas");
    app.configureGLHook = configure;
    app.loadSceneHook   = load;
    app.drawSceneHook   = render;
    app.run(); 
}
</script>
</head>

<body onLoad='runShowRoom()'>
<div id="header">
    <h1>Show Room</h2>
</div>

<div id="nav">
    <b>Instructions</b>
</div>

<div id="content">
    <canvas id='the-canvas'></canvas>
</div>

<script type='text/javascript'>resizeCanvas();</script>
</body>
</html>