Two Squares : OpenGL
a) The first square can be moved left, up, down and right using the keys ‘a’, ‘w’, ‘s’ and ‘d’ respectively.
b) The second square can be moved in the four directions using the arrow keys i.e. the Up, Down, Left and Right keys.
c) Pressing ‘F1’ moves the first square to the top of the window and the second square to the bottom of the window.
d) Pressing ‘F2’ works just opposite to pressing ‘F1’.
e) Press ‘F1’ and ‘F2’ repeatedly a couple of times and you get a nice animation of two squares moving up and down repeatedly.
The following video shows the Two Squares program in action :
Click here to view and download the source code of this project.
Click here to download Two Squares.exe only (You’ll need glut.dll for running this application. Put both the executable and glut.dll in the same folder).