A simple OpenGL and SDL2 project that renders a 3D rotating cube with specular lighting and bump mapping. Each face of the cube is uniquely colored, and the cube rotates continuously, demonstrating basic 3D graphics techniques including transformations, lighting, and fragment shading.
recording.mp4
- SDL2: Simple DirectMedia Layer library for handling window creation and input.
- GLEW: OpenGL Extension Wrangler Library to manage OpenGL extensions.
- GLM: OpenGL Mathematics library for handling matrix and vector operations.
-
Install Dependencies:
- On macOS (Homebrew):
brew install sdl2 glew glm
- On Linux (Ubuntu):
sudo apt-get install libsdl2-dev libglew-dev libglm-dev
- On macOS (Homebrew):
-
Clone the Repository:
git clone https://github.com/jonfryd/OpenGL-SDL2-Rotating-Cube.git cd OpenGL-SDL2-Rotating-Cube
-
Compile the Project: Simply run
make
in the project directory. TheMakefile
will automatically detect your operating system and use the appropriate commands.make
-
Run the Executable:
./rotating_cube
Run the compiled executable to see the continuously rotating cube.
- Space: Toggle auto-rotation
- Escape: Quit
Move the mouse to manually apply additional rotation.
Created by Jon Frydensbjerg (email: [email protected]) with plenty of support from ChatGPT.