Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General "janitorial" fixes #6

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Empty file modified Chap10/README.txt
100755 → 100644
Empty file.
Empty file modified Chap10/mandelbrot1.html
100755 → 100644
Empty file.
Empty file modified Chap10/mandelbrot1.js
100755 → 100644
Empty file.
Empty file modified Chap10/mandelbrot2.html
100755 → 100644
Empty file.
Empty file modified Chap10/mandelbrot2.js
100755 → 100644
Empty file.
Empty file modified Chap10/particleSystem.html
100755 → 100644
Empty file.
Empty file modified Chap10/particleSystem.js
100755 → 100644
Empty file.
Empty file modified Chap11/README.txt
100755 → 100644
Empty file.
Empty file modified Chap11/patches.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot1.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot1.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot2.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot2.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot3.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot3.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot4.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot4.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot5.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot5.js
100755 → 100644
Empty file.
Empty file modified Chap11/teapot6.html
100755 → 100644
Empty file.
Empty file modified Chap11/teapot7.html
100755 → 100644
Empty file.
Empty file modified Chap11/vertices.js
100755 → 100644
Empty file.
Empty file modified Chap2/README.txt
100755 → 100644
Empty file.
Empty file modified Chap2/gasket1.html
100755 → 100644
Empty file.
Empty file modified Chap2/gasket1.js
100755 → 100644
Empty file.
Empty file modified Chap2/gasket1v2.html
100755 → 100644
Empty file.
Empty file modified Chap2/gasket1v2.js
100755 → 100644
Empty file.
Empty file modified Chap2/gasket2.html
100755 → 100644
Empty file.
Empty file modified Chap2/gasket2.js
100755 → 100644
Empty file.
Empty file modified Chap2/gasket3.html
100755 → 100644
Empty file.
Empty file modified Chap2/gasket3.js
100755 → 100644
Empty file.
Empty file modified Chap2/gasket4.html
100755 → 100644
Empty file.
Empty file modified Chap2/gasket4.js
100755 → 100644
Empty file.
Empty file modified Chap2/shaders/fshader21.glsl
100755 → 100644
Empty file.
Empty file modified Chap2/shaders/vshader21.glsl
100755 → 100644
Empty file.
Empty file modified Chap3/README.txt
100755 → 100644
Empty file.
Empty file modified Chap3/cad1.html
100755 → 100644
Empty file.
Empty file modified Chap3/cad1.js
100755 → 100644
Empty file.
Empty file modified Chap3/cad2.html
100755 → 100644
Empty file.
Empty file modified Chap3/cad2.js
100755 → 100644
Empty file.
Empty file modified Chap3/gasket5.html
100755 → 100644
Empty file.
Empty file modified Chap3/gasket5.js
100755 → 100644
Empty file.
Empty file modified Chap3/square.html
100755 → 100644
Empty file.
Empty file modified Chap3/square.js
100755 → 100644
Empty file.
Empty file modified Chap3/squarem.html
100755 → 100644
Empty file.
Empty file modified Chap3/squarem.js
100755 → 100644
Empty file.
Empty file modified Chap3/triangle.html
100755 → 100644
Empty file.
Empty file modified Chap3/triangle.js
100755 → 100644
Empty file.
Empty file modified Chap4/README.txt
100755 → 100644
Empty file.
Empty file modified Chap4/cube.html
100755 → 100644
Empty file.
Empty file modified Chap4/cube.js
100755 → 100644
Empty file.
Empty file modified Chap4/cubeq.html
100755 → 100644
Empty file.
Empty file modified Chap4/cubeq.js
100755 → 100644
Empty file.
Empty file modified Chap4/cubev.html
100755 → 100644
Empty file.
Empty file modified Chap4/cubev.js
100755 → 100644
Empty file.
Empty file modified Chap4/trackball.html
100755 → 100644
Empty file.
Empty file modified Chap4/trackball.js
100755 → 100644
Empty file.
Empty file modified Chap4/trackballQuaterion.html
100755 → 100644
Empty file.
Empty file modified Chap4/trackballQuaterion.js
100755 → 100644
Empty file.
Empty file modified Chap5/README.txt
100755 → 100644
Empty file.
Empty file modified Chap5/hat.html
100755 → 100644
Empty file.
Empty file modified Chap5/hat.js
100755 → 100644
Empty file.
Empty file modified Chap5/hata.html
100755 → 100644
Empty file.
Empty file modified Chap5/hata.js
100755 → 100644
Empty file.
Empty file modified Chap5/ortho.html
100755 → 100644
Empty file.
Empty file modified Chap5/ortho.js
100755 → 100644
Empty file.
Empty file modified Chap5/ortho1.html
100755 → 100644
Empty file.
Empty file modified Chap5/ortho1.js
100755 → 100644
Empty file.
Empty file modified Chap5/ortho2.html
100755 → 100644
Empty file.
Empty file modified Chap5/ortho2.js
100755 → 100644
Empty file.
Empty file modified Chap5/perspective.html
100755 → 100644
Empty file.
Empty file modified Chap5/perspective.js
100755 → 100644
Empty file.
Empty file modified Chap5/perspective1.html
100755 → 100644
Empty file.
Empty file modified Chap5/perspective1.js
100755 → 100644
Empty file.
Empty file modified Chap5/perspective2.html
100755 → 100644
Empty file.
Empty file modified Chap5/perspective2.js
100755 → 100644
Empty file.
Empty file modified Chap5/shadow.html
100755 → 100644
Empty file.
Empty file modified Chap5/shadow.js
100755 → 100644
Empty file.
Empty file modified Chap6/README.txt
100755 → 100644
Empty file.
Empty file modified Chap6/shadedCube.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedCube.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere1.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere1.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere2.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere2.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere3.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere3.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere4.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphere4.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphereEyeSpace.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphereEyeSpace.js
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphereObjectSpace.html
100755 → 100644
Empty file.
Empty file modified Chap6/shadedSphereObjectSpace.js
100755 → 100644
Empty file.
Empty file modified Chap6/wireSphere.html
100755 → 100644
Empty file.
Empty file modified Chap6/wireSphere.js
100755 → 100644
Empty file.
Empty file modified Chap7/README.txt
100755 → 100644
Empty file.
Empty file modified Chap7/SA2011_black.gif
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Chap7/bumpMap.html
100755 → 100644
Empty file.
Empty file modified Chap7/bumpMap.js
100755 → 100644
Empty file.
Empty file modified Chap7/bumpMap2.html
100755 → 100644
Empty file.
Empty file modified Chap7/bumpMap2.js
100755 → 100644
Empty file.
Empty file modified Chap7/cubet.html
100755 → 100644
Empty file.
Empty file modified Chap7/cubet.js
100755 → 100644
Empty file.
Empty file modified Chap7/hatImage1.html
100755 → 100644
Empty file.
Empty file modified Chap7/hatImage1.js
100755 → 100644
Empty file.
Empty file modified Chap7/hatImage2.html
100755 → 100644
Empty file.
Empty file modified Chap7/hatImage2.js
100755 → 100644
Empty file.
Empty file modified Chap7/hawaiiImage.html
100755 → 100644
Empty file.
Empty file modified Chap7/hawaiiImage.js
100755 → 100644
Empty file.
Empty file modified Chap7/hawaiiIsobel.html
100755 → 100644
Empty file.
Empty file modified Chap7/hawaiisobel.js
100755 → 100644
Empty file.
Empty file modified Chap7/honolulu256.js
100755 → 100644
Empty file.
Empty file modified Chap7/honolulu4.js
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube.html
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube.js
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube2.html
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube2.js
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube3.html
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube3.js
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube4.html
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube4.js
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube5.html
100755 → 100644
Empty file.
Empty file modified Chap7/pickCube5.js
100755 → 100644
Empty file.
Empty file modified Chap7/reflectiingCube.html
100755 → 100644
Empty file.
Empty file modified Chap7/reflectingCube.js
100755 → 100644
Empty file.
Empty file modified Chap7/reflectingSphere.html
100755 → 100644
Empty file.
Empty file modified Chap7/reflectingSphere.js
100755 → 100644
Empty file.
Empty file modified Chap7/reflectionMap.html
100755 → 100644
Empty file.
Empty file modified Chap7/reflectionMap.js
100755 → 100644
Empty file.
Empty file modified Chap7/reflectionMap2.html
100755 → 100644
Empty file.
Empty file modified Chap7/reflectionMap2.js
100755 → 100644
Empty file.
Empty file modified Chap7/render1.html
100755 → 100644
Empty file.
Empty file modified Chap7/render1.js
100755 → 100644
Empty file.
Empty file modified Chap7/render1v2.html
100755 → 100644
Empty file.
Empty file modified Chap7/render1v2.js
100755 → 100644
Empty file.
Empty file modified Chap7/render3.html
100755 → 100644
Empty file.
Empty file modified Chap7/render3.js
100755 → 100644
Empty file.
Empty file modified Chap7/render4.html
100755 → 100644
Empty file.
Empty file modified Chap7/render4.js
100755 → 100644
Empty file.
Empty file modified Chap7/render5.html
100755 → 100644
Empty file.
Empty file modified Chap7/render5.js
100755 → 100644
Empty file.
Empty file modified Chap7/textureCube1.html
100755 → 100644
Empty file.
Empty file modified Chap7/textureCube1.js
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev2.html
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev2.js
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev3.html
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev3.js
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev4.html
100755 → 100644
Empty file.
Empty file modified Chap7/textureCubev4.js
100755 → 100644
Empty file.
Empty file modified Chap7/textureSquare.html
100755 → 100644
Empty file.
Empty file modified Chap7/textureSquare.js
100755 → 100644
Empty file.
Empty file modified Chap9/README.txt
100755 → 100644
Empty file.
Empty file modified Chap9/figure.html
100755 → 100644
Empty file.
Empty file modified Chap9/figure.js
100755 → 100644
Empty file.
Empty file modified Chap9/robotArm.html
100755 → 100644
Empty file.
Empty file modified Chap9/robotArm.js
100755 → 100644
Empty file.
398 changes: 203 additions & 195 deletions Common/MV.js
100755 → 100644

Large diffs are not rendered by default.

Empty file modified Common/README.txt
100755 → 100644
Empty file.
47 changes: 23 additions & 24 deletions Common/initShaders.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,47 @@ function initShaders( gl, vertexShaderId, fragmentShaderId )
{
var vertShdr;
var fragShdr;
var msg;

var vertElem = document.getElementById( vertexShaderId );
if ( !vertElem ) {
if ( !vertElem ) {
alert( "Unable to load vertex shader " + vertexShaderId );
return -1;
}
else {
vertShdr = gl.createShader( gl.VERTEX_SHADER );
gl.shaderSource( vertShdr, vertElem.text );
gl.compileShader( vertShdr );
if ( !gl.getShaderParameter(vertShdr, gl.COMPILE_STATUS) ) {
var msg = "Vertex shader failed to compile. The error log is:"
+ "<pre>" + gl.getShaderInfoLog( vertShdr ) + "</pre>";
alert( msg );
return -1;
}

vertShdr = gl.createShader( gl.VERTEX_SHADER );
gl.shaderSource( vertShdr, vertElem.text );
gl.compileShader( vertShdr );
if ( !gl.getShaderParameter(vertShdr, gl.COMPILE_STATUS) ) {
msg = "Vertex shader failed to compile. The error log is:"
+ "<pre>" + gl.getShaderInfoLog( vertShdr ) + "</pre>";
alert( msg );
return -1;
}

var fragElem = document.getElementById( fragmentShaderId );
if ( !fragElem ) {
if ( !fragElem ) {
alert( "Unable to load vertex shader " + fragmentShaderId );
return -1;
}
else {
fragShdr = gl.createShader( gl.FRAGMENT_SHADER );
gl.shaderSource( fragShdr, fragElem.text );
gl.compileShader( fragShdr );
if ( !gl.getShaderParameter(fragShdr, gl.COMPILE_STATUS) ) {
var msg = "Fragment shader failed to compile. The error log is:"
+ "<pre>" + gl.getShaderInfoLog( fragShdr ) + "</pre>";
alert( msg );
return -1;
}

fragShdr = gl.createShader( gl.FRAGMENT_SHADER );
gl.shaderSource( fragShdr, fragElem.text );
gl.compileShader( fragShdr );
if ( !gl.getShaderParameter(fragShdr, gl.COMPILE_STATUS) ) {
msg = "Fragment shader failed to compile. The error log is:"
+ "<pre>" + gl.getShaderInfoLog( fragShdr ) + "</pre>";
alert( msg );
return -1;
}

var program = gl.createProgram();
gl.attachShader( program, vertShdr );
gl.attachShader( program, fragShdr );
gl.linkProgram( program );

if ( !gl.getProgramParameter(program, gl.LINK_STATUS) ) {
var msg = "Shader program failed to link. The error log is:"
msg = "Shader program failed to link. The error log is:"
+ "<pre>" + gl.getProgramInfoLog( program ) + "</pre>";
alert( msg );
return -1;
Expand Down
70 changes: 34 additions & 36 deletions Common/initShaders2.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
// Get a file as a string using AJAX
function loadFileAJAX(name) {
var xhr = new XMLHttpRequest(),
okStatus = document.location.protocol === "file:" ? 0 : 200;
xhr.open('GET', name, false);
xhr.send(null);
return xhr.status == okStatus ? xhr.responseText : null;
};

// Get a file as a string using AJAX
function loadFileAJAX(name) {
var xhr = new XMLHttpRequest(),
okStatus = document.location.protocol === "file:" ? 0 : 200;
xhr.open('GET', name, false);
xhr.send(null);
return xhr.status == okStatus ? xhr.responseText : null;
};


function initShaders(gl, vShaderName, fShaderName) {
function getShader(gl, shaderName, type) {
var shader = gl.createShader(type),
shaderScript = loadFileAJAX(shaderName);
if (!shaderScript) {
alert("Could not find shader source: "+shaderName);
}
gl.shaderSource(shader, shaderScript);
gl.compileShader(shader);

if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
alert(gl.getShaderInfoLog(shader));
return null;
}
return shader;
function initShaders(gl, vShaderName, fShaderName) {
function getShader(gl, shaderName, type) {
var shader = gl.createShader(type),
shaderScript = loadFileAJAX(shaderName);
if (!shaderScript) {
alert("Could not find shader source: "+shaderName);
}
var vertexShader = getShader(gl, vShaderName, gl.VERTEX_SHADER),
fragmentShader = getShader(gl, fShaderName, gl.FRAGMENT_SHADER),
program = gl.createProgram();

gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
gl.shaderSource(shader, shaderScript);
gl.compileShader(shader);

if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
alert("Could not initialise shaders");
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
alert(gl.getShaderInfoLog(shader));
return null;
}
return shader;
}
var vertexShader = getShader(gl, vShaderName, gl.VERTEX_SHADER),
fragmentShader = getShader(gl, fShaderName, gl.FRAGMENT_SHADER),
program = gl.createProgram();

gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);

if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
alert("Could not initialise shaders");
return null;
}


return program;
};

return program;
};
Loading