OpenGL and GLUT program that display a 2D triangle and a Cartesian graph (𝑥, 𝑦) (use -10 and +10 as the min and max value for both 𝑥 and 𝑦-axis).
Copyright: MD SAIFUDDIN TIPU
Department of Software Engineering, University Malaysia Sarawak
Enter co-ordinates for vertex 3 times...
input will have to enter like 0 2
2 0
-2 0
Enter your choice:
|1. Translation
|2. Scaling
|3. Rotation
Type: input (1 2 or 3)
if enter 1:
Enter the Translation factor for X and Y: (2 1) (Tx Ty)
if enter 2:
Enter the Reference point for X and Y (Type(0,0) for origin): (0 0) or (Xref Yref)
Enter the Scaling factor for X and Y: (Sx Sy)
if enter 3:
Select Rotation Type:
-
Counter-Clockwise
-
Clockwise
Choose: (Type 1 or 2)
Enter the Pivot Point for X and Y(Origin(0, 0)): (Px Py)
Enter the angle for rotation: 45
After entering the details in the terminal, The Glut Window will open and show the Tranformations.
Once we Click the X button in Glut Window....
The Terminal ask that we want to continue the session or not...
If Yes type 1,
if No type 2.
Original Triangle: RED COLOR
Translated Triangle: GREEN COLOR
Scaled Triangle: BLUE COLOR
Rotated Triangle: BLUE COLOR also