Programming and Graphics

(Kiana) #1

210 Introduction to C++ Programming and Graphics


(a)(b)

Figure 7.3.1. Snapshot of (a) an animated rotating polygon produced by the code
poly2d,and(b) icosahedron produced by the codelicosa.

{
vexit();
exit(1);
}

t=t+Dt; // update time

goto repeat;

//--- Done

return 0;
}

Figure 7.3.1(a) shows a snapshot of the animation. The code features the
following implementations:



  • When the cursor is on the graphics window and the “q” key is pressed,
    the execution terminates.

  • When the cursor is on the graphics window and the “s” key is pressed,
    the execution halts and resumes when another key is pressed.


We see that only a handful of simple graphics commands are necessary to
program animation, and this is generally true for most applications. However,

Free download pdf