An OpenGL-based stellar spiral rotation effect.
- Multiple stars rotate around a center point
- Stars have different colors
- Stars rotate and spread out along spiral paths
- Implementation of three different spiral types:
- Archimedes spiral: r = a + bθ
- Fermat spiral: r = a√θ
- Logarithmic spiral: r = ae^(bθ)
Wikipedia references:
- Uses modern OpenGL rendering pipeline
- Implements star rendering with GLSL shaders
- Uses texture mapping for star patterns
- Employs additive blending for overlapping star colors
- Dynamically calculates transparency based on star brightness
- C++17 compatible compiler
- CMake 3.10+
- OpenGL 3.3+
- GLEW
- GLFW3
- GLM
mkdir build
cd build
cmake ..
make
The program supports the following command line arguments:
Usage: ./star_rotation [options]
Options:
-a Use Archimedes spiral
-f Use Fermat spiral
-l Use Logarithmic spiral
-all Use all spiral types (default)
-h Display help information
For example, to display only the Archimedes spiral:
./star_rotation -a
star_rotation/
├── include/ # Header files
│ ├── shader.h # Shader class
│ ├── spiral.h # Spiral class
│ ├── star.h # Star class
│ └── stb_image.h # Image loading library
├── src/ # Source files
│ ├── main.cpp # Main program
│ ├── shader.cpp # Shader implementation
│ ├── spiral.cpp # Spiral implementation
│ ├── star.cpp # Star implementation
│ └── stb_image.cpp # Image loading implementation
├── shaders/ # GLSL shader files
│ ├── star.vert # Vertex shader
│ └── star.frag # Fragment shader
├── texture/ # Texture files
│ └── Star.bmp # Star texture
├── CMakeLists.txt # CMake configuration file
├── README.md # Project description
└── report.md # Technical report
When running the program, you will see multiple stars of different colors rotating and spreading out along spiral paths. The colors of the stars vary, and overlapping areas produce additive color effects, creating a vibrant visual display.
You can customize the effect by modifying the following parameters:
- Adjust spiral parameters in main.cpp to change the paths
- Modify the createStars() function parameters to adjust star count and size
- Adjust blending modes and transparency calculations in the shaders