Download presentation
Presentation is loading. Please wait.
1
Lab 7 Viewing
2
Parallel vs. Perspective Projection
Parallel projection (Orthographic) glMatrixMode(GL_PROJECTION); glOrtho(xwmin,xwmax,ywmin,ywmax,dnear,dfar); Perspective Projection Two ways to use Perspective Projection: glMatrixMode(GL_PROJECTION); gluPerspective(theta,aspect,dnear,dfar); 1 glMatrixMode(GL_PROJECTION); gluFrustum(left,right,bottom,top,near,far); 2
4
gluLookAt() Function gluLookAt function: positions and aims the camera towards where the object is drawn. glLookAt(Xeye, Yeye, Zeye, Xat, Yat, Zat, Xup, Yup,Zup); glLookAt(0,0,6,0,0,0,0,1,0) glLookAt(0,0,-6,0,0,0,0,1,0) glLookAt(6,6,6,0,0,0,0,1,0)
5
glViewport() Function
glViewport() function: it let you choose a smaller drawing region in the window. It is set by default to window’s size. glViewport(x, y, width, height); After using viewport to a specific region in the window Default viewport
6
glViewport() Function
7
Exercise 1 – drawing object twice using viewport
void display(){ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glLoadIdentity(); gluLookAt(0.0, 0, 5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glViewport(0, 0, 400, 500); glutWireCube(1); glViewport(400, 0, 400, 500); glFlush(); }
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.