A lightweight 2D airplane animation built in C using OpenGL and GLUT.
The project demonstrates basic graphics programming, animation techniques, and modular scene rendering.
- Gradient sky background
- Seamless, animated cloud movement
- Custom airplane model (body, wings, tail, nose, details)
- Smooth 60 FPS animation with timer-based updates
- Modular and readable codebase
-
Install dependencies:
brew install freeglut
-
Build and run:
gcc main.c -I/opt/homebrew/include -framework OpenGL -framework GLUT -o airplane && ./airplane
-
Install MinGW and FreeGLUT binaries.
-
Place the FreeGLUT files:
- Headers (
freeglut.h, etc.) →C:\MinGW\include\GL\ - Libraries (
libfreeglut.aor.lib) →C:\MinGW\lib\ - DLL (
freeglut.dll) → same directory as the executable or inC:\Windows\System32\
- Headers (
-
Build and run:
gcc main.c -lfreeglut -lopengl32 -o airplane.exe airplane.exe
-
Create a new empty project.
-
Add
main.c. -
In Build Options → Linker Settings, add:
freeglut opengl32 -
Build and run.
- Open the project folder in VS Code.
- Install the Microsoft C/C++ extension.
- Use the terminal to compile with the commands provided above,
or configure a
tasks.jsonfor one-click build and run.
Example tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build and Run Airplane",
"type": "shell",
"command": "gcc main.c -lfreeglut -lopengl32 -o airplane.exe && airplane.exe",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"]
}
]
}main.c— Rendering and animation logicREADME.md— Project documentation
- Independent functions for each scene element (sky, clouds, airplane, etc.)
- OpenGL primitives:
GL_QUADS,GL_TRIANGLE_FAN,GL_LINE_LOOP - Animation via timer callback and global offset variable
This project is open source and available under the MIT License.
