Description
This week’s discussion has provided an introduction to viewing, particularly with respect to various projections and related functions. In this assignment, you will briefly discuss several viewing functions and then use the code snippet in section 5.4.6 to design an interactive Viewer using WebGL.
function render()
{
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
eye = vec3(radius * Math.sin(theta) * Math.cos(phi),
radius * Math.sin(theta) * Math.sin(phi),
radius * Math.cos(theta));
modelViewMatrix = lookAt(eye, at, up);
projectionMatrix = ortho(left, right, bottom, ytop, near, far);
gl.uniformMatrix4fv(modelViewMatrixLoc, false,
flatten(modelViewMatrix));
gl.uniformMatrix4fv(projectionMatrixLoc, false,
flatten(projectionMatrix));
gl.drawArrays(gl.TRIANGLES, 0, numPositions);
requestAnimationFrame(render);
}
In your program:
- Include screenshots your working program
- Submit all the source files of your working program
I am needing WebGL program using the template above and screenshots please. Explanation of the program is not necessary.