Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonfryd/opengl-sdl2-rotating-cube
Rotating 3D cube with specular lighting, bump mapping and fragment shading using OpenGL and SDL2
https://github.com/jonfryd/opengl-sdl2-rotating-cube
opengl sdl2 shading-effects
Last synced: about 2 months ago
JSON representation
Rotating 3D cube with specular lighting, bump mapping and fragment shading using OpenGL and SDL2
- Host: GitHub
- URL: https://github.com/jonfryd/opengl-sdl2-rotating-cube
- Owner: jonfryd
- License: mit
- Created: 2024-07-22T07:42:58.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T12:07:38.000Z (5 months ago)
- Last Synced: 2024-10-19T22:14:30.794Z (3 months ago)
- Topics: opengl, sdl2, shading-effects
- Language: C++
- Homepage:
- Size: 186 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenGL-SDL2-Rotating-Cube
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.
https://github.com/user-attachments/assets/ce4eceea-973c-4cab-a118-964f9b40741b
## Prerequisites
- **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.## Installation
1. **Install Dependencies**:
- On macOS (Homebrew):
```sh
brew install sdl2 glew glm
```
- On Linux (Ubuntu):
```sh
sudo apt-get install libsdl2-dev libglew-dev libglm-dev
```2. **Clone the Repository**:
```sh
git clone https://github.com/jonfryd/OpenGL-SDL2-Rotating-Cube.git
cd OpenGL-SDL2-Rotating-Cube
```## Building the Project
1. **Compile the Project**:
Simply run `make` in the project directory. The `Makefile` will automatically detect your operating system and use the appropriate commands.```sh
make
```2. **Run the Executable**:
```sh
./rotating_cube
```## Usage
Run the compiled executable to see the continuously rotating cube.
## Controls
- Space: Toggle auto-rotation
- Escape: QuitMove the mouse to manually apply additional rotation.
## Credits
Created by Jon Frydensbjerg (email: [email protected]) with plenty of support from ChatGPT.