logo

Crowdly

The following shows the render function of the textbook example code "perspectiv...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

The following shows the render function of the textbook example code "perspective2.js". What coordinate system is used for the vec3 for "eye"?

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 = perspective(fovy, aspect, near, far);

    gl.uniformMatrix4fv(modelViewMatrixLoc, false, flatten(modelViewMatrix));

    gl.uniformMatrix4fv(projectionMatrixLoc, false, flatten(projectionMatrix));

    gl.drawArrays(gl.TRIANGLES, 0, numPositions);

    requestAnimationFrame(render);

}

More questions like this

Want instant access to all verified answers on learn.twu.ca?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!