Compile: g++ car.cpp –lglut -Lglu Run: ./a.out The options available in the paint are as follows in respective order:
- UP Arrow -To move the car forward.
- Down Arrow- To move the car backward
- Left Arrow – To rotate the car left
- Right Arrow – TO rotate the car right.
- F1 – To Switch between views.
Implementation
- First the Track is designed.
- Then the car is designed.
- The arrow keys are used to move the car which are implemented using specialFunc.
- F1 key will sitch the views which is done using changing the buffer values
- The car position is stored at every movement and again used that for further changes.