building a camera in a program | computer graphics
TRANSCRIPT
Building camera in a program
Aravindhan AFinal year CSE | SMITabout.me/aravindhan
Why build camera?
To have finite control over camera movements, we create and manipulate our own camera in a program
Created through a camera class which can do all functions
Camera functions
Cam.set(eye,look,up);Cam.slide(-1,0,-2);Cam.roll(30);Cam.yaw(20);
Camera functions
setModelViewMatrix()glMatrixMode(GL_PROJECTION)GlLoadIdentity()myKeyboard()
Model-view matrix
Position the camera By default, camera is at origin, looking in –z dir To “move the camera”, set up a modelview matrix that
moves objects that are drawn Ignore Z-coordinate when drawing
LookAt function Most 3D toolkits let you position the camera by
setting eyepoint, lookpoint, and up direction lookAt(Xeye, Yeye, Zeye, Xat, Yat, Zat,
Xup, Yup, Zup): Effect: set the
modelview matrix
LookAt function
Other viewing APIs
Thank you!