Game Development Reference
In-Depth Information
var magnification=$("#magnificationFilter
option:selected").val();
distance=parseInt($("#distanceList option:selected").val());
switch(minification) {
case "NEAREST":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.NEAREST);
break;
case "LINEAR":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.LINEAR);
break;
case "NEAREST_MIPMAP_NEAREST":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.NEAREST_MIPMAP_NEAREST);
break;
case "LINEAR_MIPMAP_NEAREST":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.LINEAR_MIPMAP_NEAREST);
break;
case "NEAREST_MIPMAP_LINEAR":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.NEAREST_MIPMAP_LINEAR);
break;
case "LINEAR_MIPMAP_LINEAR":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
gl.LINEAR_MIPMAP_LINEAR);
break;
}
switch(magnification) {
case "NEAREST":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER,
gl.NEAREST);
break;
case "LINEAR":
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER,
gl.LINEAR);
break;
}
gl.bindTexture(gl.TEXTURE_2D, null);
drawScene();
}
Change the drawScene function to translate mvMatrix by the distance variable set
in the changeValues function. This translation is like moving the camera closer or
farther from the model. The required change is shown as follows:
mat4.translate(mvMatrix, mvMatrix, [0.0, 0.0, distance]);
 
Search WWH ::




Custom Search