CSC 4356/prog7/prog7.js
/**
 * An object that represents GLSL shaders embedded within HTML
 * vertexShader the DOM element id of the vertex shader.
 * fragmentShader the DOM element id of the fragment shader.
 */
An object that represents GLSL shaders embedded within HTML
vertexShader the DOM element id of the vertex shader.
fragmentShader the DOM element id of the fragment shader.
An object that represents GLSL shaders embedded within HTML vertexShader the DOM element id of the vertex shader . fragmentShader the DOM element id of the fragment shader .
function Shader(vertexShader, fragmentShader){
    vertexSource   = document.getElementById(vertexShader).text;
    fragmentSource = document.getElementById(fragmentShader).text;
    this.program = createProgram(gl, vertexSource, fragmentSource); 
    this.projectionMatrixLocation = gl.getUniformLocation(this.program, "projectionMatrix");
    this.viewMatrixLocation       = gl.getUniformLocation(this.program, "viewMatrix");
    this.modelMatrixLocation      = gl.getUniformLocation(this.program, "modelMatrix");
    this.modelTextureLocation     = gl.getUniformLocation(this.program, "modelTexture");
    this.lightPositionLocation    = gl.getUniformLocation(this.program, "lightPosition");
    this.lightColorLocation       = gl.getUniformLocation(this.program, "lightColor");
    this.modelTextureLocation     = gl.getUniformLocation(this.program, "modelTexture");
    this.vertexPositionLocation = gl.getAttribLocation(this.program, 'vertexPosition');
    this.vertexNormalLocation   = gl.getAttribLocation(this.program, 'vertexNormal');
    this.vertexTexCoordLocation = gl.getAttribLocation(this.program, 'vertexTexCoord');
}
function Shader ( vertexShader , fragmentShader ) { vertexSource = document . getElementById ( vertexShader ) . text ; fragmentSource = document . getElementById ( fragmentShader ) . text ; this . program = createProgram ( gl , vertexSource , fragmentSource ) ; this . projectionMatrixLocation = gl . getUniformLocation ( this . program , "projectionMatrix" ) ; this . viewMatrixLocation = gl . getUniformLocation ( this . program , "viewMatrix" ) ; this . modelMatrixLocation = gl . getUniformLocation ( this . program , "modelMatrix" ) ; this . modelTextureLocation = gl . getUniformLocation ( this . program , "modelTexture" ) ; this . lightPositionLocation = gl . getUniformLocation ( this . program , "lightPosition" ) ; this . lightColorLocation = gl . getUniformLocation ( this . program , "lightColor" ) ; this . modelTextureLocation = gl . getUniformLocation ( this . program , "modelTexture" ) ; this . vertexPositionLocation = gl . getAttribLocation ( this . program , 'vertexPosition' ) ; this . vertexNormalLocation = gl . getAttribLocation ( this . program , 'vertexNormal' ) ; this . vertexTexCoordLocation = gl . getAttribLocation ( this . program , 'vertexTexCoord' ) ; }
An object that represents GLSL shaders embedded within HTML
 vertexShader the DOM element id of the vertex shader.
An object that represents GLSL shaders embedded within HTML vertexShader the DOM element id of the vertex shader .
//Initialize the program objects // Load onto GPU for execution. //Initialize uniform objects //Configure attributes of the position buffer