Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4.

Similar presentations


Presentation on theme: "Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4."— Presentation transcript:

1 Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4

2 Figure 4.1: Screenshot of box.cpp.

3 Figure 4.2: Translation: glTranslatef(p, q, r).

4 Figure 4.3: Translating into the viewing frustum.

5 Figure 4.4: Screenshot of Experiment 4.3.

6 Figure 4.5: Scaling: glScalef(u, v, w).

7 Figure 4.6: Screenshot of initial configuration of Experiment 4.4.

8 Figure 4.7: Reflection in the yz-plane.

9 Figure 4.8: Screenshots of Experiment 4.5: (a) before scaling (b) after.

10 Figure 4.9: Screenshot for Experiment 4.6.

11 Figure 4.10: Turning along a cylinder.

12 Figure 4.11: Rotation: glRotatef(A, p, q, r). The point P is rotated according to the 4-step process in the text. The rotation of a box is also shown.

13 Figure 4.12: glRotatef(A, 0.0, 0.0, 1.0).

14 Figure 4.13: Screenshots from Experiment 4.9.

15 Figure 4.14: Rotating a square about its own center.

16 Figure 4.15: Screenshots: (a) Experiments 4.10 and (b) 4.11.

17 Figure 4.16: Local system (bold) coincides with the global initially. The global system is fixed.

18 Figure 4.17: Transitions of the box, the box's local coordinates system (bold) and the sphere. The world coordinate system, which never changes, coincides with the box's initial local.

19 Figure 4.18: Screenshot of relativePlacement.cpp after all transformations from the scaling down have been executed.

20 Figure 4.19: Planning a head on a torso: (a) The plan (b) Drawn without isolating the scaling (c) After isolating the scaling.

21 Figure 4.20: Transitions of the modelview matrix stack.

22 Figure 4.21: Screenshot of rotatingHelix1.cpp.

23 Figure 4.22: Animation control in rotatingHelix3.cpp.

24 Figure 4.23: Successive cycles in double buffering.

25 Figure 4.24: Screenshot of ballAndTorus.cpp.

26 Figure 4.25: The ball's axis of latitudinal rotation from its start position is L.

27 Figure 4.26: Screenshot from Experiment 4.21.

28 Figure 4.27: Screenshot of throwBall.cpp.

29 Figure 4.28: Ball bouncing off wall.

30 Figure 4.29: Screenshot of (a) clown1.cpp (b) clown2.cpp (c) clown3.cpp.

31 Figure 4.30: (a) Cone drawn by glutWireCone(base, height, slices, stacks) (b) Torus drawn by glutWireTorus(inRadius, outRadius, sides, rings). Note that the axes are depicted differently in each diagram.

32 Figure 4.31: Screenshot of floweringPlant.cpp in mid-bloom.

33 Figure 4.32: (a) Ball rolling down one plane (b) Ball rolling down two planes (c) Ball bouncing on a box (d) Ball traveling along a helix (e) Four segments opening from a square into a straight line (f) Solar system with a sun, one planet and two moons (g) Pool table with one ball.

34 Figure 4.33: (a) The (conceptual) OpenGL camera's default pose (b) A (conceptual) point camera at the origin with film on the viewing plane of the frustum.

35 Figure 4.34: Camera pose determined by gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz).

36 Figure 4.35: (a) gluLookAt(): the broken frustum is the original viewing frustum, the unbroken one is where it's translated by the gluLookAt() call, the box doesn't move. (b) glTranslatef(): the viewing frustum doesn't move, rather the box is translated by the glTranslatef() call.

37 Figure 4.36: Sectional diagrams of the (simulated) conguration of the eye and frustum for various gluLookAt() calls in boxWithLookAt.cpp.

38 Figure 4.37: Screenshots from Experiment 4.28.

39 Figure 4.38: Taking the dot product: u·v = |u||v|cos θ.

40 Figure 4.39: (a) Splitting v into components v 1 and v 2, parallel and perpendicular to u, respectively (b) v 2 as the “shadow” of v on a plane p perpendicular to u.

41 Figure 4.40: The camera is seen face-forward so that its back-plane p lies on the page. The line of sight los comes perpendicularly up from the page toward the reader. The components of the vector up, parallel and perpendicular to los, respectively, are up 1 and up 2 (the latter lying on the page).

42 Figure 4.41: Solution to Exercise 4.44(a).

43 Figure 4.42: Checking the solution to Exercise 4.44(a).

44 Figure 4.43: Camera flying over balls.

45 Figure 4.44: Camera rotated on an imaginary sphere enclosing a teapot.

46 Figure 4.45: Relative movement of the camera and scene.

47 Figure 4.46: Restoring the camera to its default pose: broken arrows indicate movements which applied take the camera to the next conguration in the sequence (a)-(d).

48 Figure 4.47: Screenshot from Experiment 4.30.

49 Figure 4.48: Viewing transformation equivalent to a sequence of modeling transformations.

50 Figure 4.49: Applying a translation (1) and rotations (2)-(4) about the three coordinate axes to bring the camera back to its default pose. The original line of sight is bold. The up direction is shown only at the end.

51 Figure 4.50: Solution to Example 4.6: the configuration of the camera given by gluLookAt(0.0, 0.0, 0.0, 1.0, 1.0, 0.0, -1.0, 1.0, 0.0) is at left; the line of sight and up vectors are indicated by blue arrows; rotations are both annotated at the top and indicated in the figures themselves by broken arrows, the result of each rotation being the next configuration.

52 Figure 4.51: Screenshot of spaceTravel.cpp.

53 Figure 4.52: Spacecraft diagrams.

54 Figure 4.53: Ball rolling toward a box.

55 Figure 4.54: Screenshot of animateMan1.cpp.

56 Figure 4.55: Screenshot of animateMan1.cpp in develop mode.

57 Figure 4.56: Screenshot of animateMan2.cpp.

58 Figure 4.57: Screenshot of ballAndTorus- Shadowed.cpp.

59 Figure 4.58: OpenGL's synthetic-camera pipeline (highly simplified!).

60 Figure 4.59: Screenshot from selection.cpp.

61 Figure 4.60: Name stack configurations: (a) Initial (b) When the red rectangle is drawn (c) When the green rectangle is drawn.

62 Figure 4.61: Clicking P “hits” the aircraft because the latter intersects V’.

63 Figure 4.62: Screenshot of ballAndTorus- Picking.cpp moments after the ball has been clicked.

64 Figure 4.63: Color coding.


Download ppt "Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4."

Similar presentations


Ads by Google