CG Lab - Lect 5-Exercise
CG Lab - Lect 5-Exercise
n Projection
n 3D objects
+
Your program initially have this
output
Void init()
{
glMatrixMode(GL_PROJECTION);
gluPerspective( 65, (win_width/win_hight), 0.01, 50 )
glMatrixMode(GL_MODELVIEW);
gluLookAt(5, 5, 5, 0, 0, 0, 0, 1, 0);
}
+
Exercise 1: keyboard special keys
n You can use some C++ print statement to show the change in the
transValueX values. Example:
n cout<<“The translate X: ”<<transValueX<<endl;
+
Exercise 2: Perspective Projection
& camera
n In your display function, use the functions:
gluPerspective & gluLookAt => don’t forget using the appropriate
matrix for each!!!
n Use all the previous variables and interactively change their values
using the keyboard events.
n Use near, far to change the perspective projection near & far values.
n Test case2: Now try in anther example to interactively change the far
value to 4
gluPerspective( 65, (win_width/win_hight), near, far); gluPerspective( 65, (win_width/win_hight), near, far);
With far value = 4 With near value = 3.41
+
Exercise 3: Camera