Skip to content

Rotating 3D cube with specular lighting, bump mapping and fragment shading using OpenGL and SDL2

License

Notifications You must be signed in to change notification settings

jonfryd/OpenGL-SDL2-Rotating-Cube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

recording.mp4

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):
      brew install sdl2 glew glm
    • On Linux (Ubuntu):
      sudo apt-get install libsdl2-dev libglew-dev libglm-dev
  2. Clone the Repository:

    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.

    make
  2. Run the Executable:

    ./rotating_cube

Usage

Run the compiled executable to see the continuously rotating cube.

Controls

  • Space: Toggle auto-rotation
  • Escape: Quit

Move the mouse to manually apply additional rotation.

Credits

Created by Jon Frydensbjerg (email: [email protected]) with plenty of support from ChatGPT.

About

Rotating 3D cube with specular lighting, bump mapping and fragment shading using OpenGL and SDL2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published