June 2012
Beginner
376 pages
8h 32m
English
Here we set the background color and the depth test properties as follows:
gl.clearColor(0.3,0.3,0.3, 1.0); gl.clearDepth(1.0); gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.LEQUAL);
The camera variable needs to be global so we can access it later on from the GUI functions that we will write. For instance, we want to be able to click on a button (different function in the code) and use the camera variable to update the camera position:
camera = new Camera(CAMERA_ORBITING_TYPE); camera.goHome([0,0,7]); camera.setFocus([0.0,0.0,0.0]); camera.setAzimuth(25); camera.setElevation(-30);
The azimuth and elevation of the camera are relative to the negative z-axis, which will be the default pose if you do ...