3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
90 likes | 108 Vues
Learn about OpenGL transformation pipeline, model-view matrix, camera space, projection matrix, and object space. Understand the process of perspective divide to convert from homogeneous clip space to normalized device coordinates in OpenGL.
3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
E N D
Presentation Transcript
3D Computer Graphics (3080/GV10)Week 5-6 Tutorial 3 Andrew Cox
OpenGL Transformation Pipeline ModelView Matrix CameraSpace Projection Matrix Object Space HomogeneousClip Space Perspective Divide Normalized Device Coordinates Viewport Transform Viewport Coordinates Slide adapted from Eric Lengyel[1]
OpenGL Perspective Projection Matrix • n, f = distances to near, far planes • e = focal length = 1 / tan(FOV / 2) • a = viewport height / width Picks up viewspace z and places negated in w: division by Z gives perspective Slide adapted from Eric Lengyel[1]
Order of OpenGL Transformations • OpenGL calls define a matrix, then concatenate it with existing one • Transformations applied in reverse of lexical program order
Matrix Modes • GL tracks two matrix stacks • Projection • ModelView • The matrix applied to vertices is • The matrix commands apply to the current mode: • glMatrixMode(GL_PROJECTION); • glMatrixMode(GL_MODELVIEW);
glLoadIdentity() • Matrix commands are concatenated with matrix of current mode • Includes gluPerspective () etc. • Clear out current matrix with glLoadIdentity()
References • Eric Lengyel, Projection Matrix Tricks, Game Developers Conference 2007, <http://www.terathon.com/lengyel/>.