Download presentation
Presentation is loading. Please wait.
Published byAron Stewart Modified over 8 years ago
1
TA: Ryan Freedman Sushma Kini Chi Zhou
2
Due Date: March 8 2016, 12:30 PM We want a zip folder named cs418_mp1_{netid}.zip which contains Source Code folder Screen Shot folder README with compilation instructions and link to mandatory video demo Submit your zip folder on Compass Late Submission: 10% penalty each day after the due date
3
Automatic forward motion with constant speed Roll and Pitch features Use Key events to perform rolling and pitching. Document the key events used in README Transformation should be in correct order Once you pitch up, then the plane should move in direction the plane is facing Roll left + Pitch =Plane turns to the left and not straight up. 4 credits student only: Use vertex shader
4
Interactive UI (10%): Using either keyboard or mouse to control your plane interactively. Translation (20%): The plane should move forward automatically. Roll (25%): Apply correct rotation when your plane rolls left or right. Pitch (25%): Apply correct rotation when your plane pitch up and down. Performance (15%): Your simulator should run interactively and should be reasonably efficient. Documentation (5%): Your code should be commented or self-explanatory. A readme.txt should explain the features and special instructions ( if any ) to run your code. Bonus (5%): Show your creativeness in the scene, or any impressive features from your program.
5
Increase/Decrease Speed: +1 “Restart” option through key event +1 Increase/Decrease Sea level: +1 Regenerate terrain during flight sim through key event +1-5 Displaying a timer on the screen +2 Performing Yaw feature: +2 Displaying Speed on your window: +2 Generating your own new terrain: +5 Converting your flight simulator into a small game: +5
6
gluLookAt(eye_x, eye_y,eye_z, lookat_x, lookat_y, lookat_z, up_x, up_y, up_z); Initialize Eye position, LookAt, Up and R vector Constant forward motion: Offset Eye position in Lookat direction Pitch Up/Down: Rotate LookAt and Up vector about R axis Roll Left/ Right: Rotate Up, R about LookAt axis. Every time you press arrow keys, update LookAt, Up and R accordingly In display function set: gluLookAt(Eye, Eye+LookAt, Up); Eye LookAt Up R=Cross(LookAt,Up)
7
Imagine your Eye={0,0,0}, LookAt={0,0,-1}, Up={0,1,0} For Roll left by angle 30 o, you need to update R and Up. Here R={1,0,0} New Eye, LookAt, Up, R: Eye = {0,0,0} LookAt = {0,0,-1} Up = {0.5,0.866,0} R = {.866,-0.5,0} Eye LookAt Up R Eye LookAt Up R
8
Moving camera is equivalent to moving every object in the world towards a stationary camera Using a fixed gluLookAt, but call OpenGL transformation command instead. Where should you put glTranslate/glRotate to simulate a flight simulator ? Before or after gluLookAt ? Remember premultiply? “glMultMatrix multiplies the current matrix with the one specified using m, and replaces the current matrix with the product.”
9
glPushMatrix() : Create a copy of top matrix & push it into stack. glPopMatrix() : Remove the top matrix from stack Example: Drawing each object : glPushMatrix();glTranslate()glScale()glBegin()….glEnd()glPopMatrix();
10
Use glutSpecialFunc(int key, int x, int y) for using arrow key events. Reference: https://www.opengl.org/resources/libraries/glut/spec3/node54.htmlhttps://www.opengl.org/resources/libraries/glut/spec3/node54.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.