3D cube rendered in C++ and OpenGL
Find a file
2026-03-26 10:32:11 -04:00
images
3DCube.cpp
README.md Update README.md 2026-03-26 10:32:11 -04:00

OpenC++

Tiny OpenGL cube in C++. Yea i made it quick beacuse i had no time (im sorry :3). It's very basic and i think even a 6 year old can use it!

Keybinds

Keybinds are easy and are on the User Interface (UI):

  • Left click + drag → rotate camera
  • W/A/S/D → move camera
  • Arrow keys → rotate cube
  • Q/E → scale X
  • R/F → scale Y
  • T/G → scale Z
  • Shift+W → toggle wireframe
  • Space → reset cube

Installation

Required Dependencies


  • GCC

Required Sub Dependencies


  • OpenGL
  • GLFW
  • GLU
  • GLUT (FreeGLUT)
  • a good PC and good GPU/CPU

Package Installing:

  • Fedora: sudo dnf install glfw-devel mesa-libGL-devel mesa-libGLU-devel freeglut-devel
  • Arch Linux: sudo pacman -S glfw-x11 mesa glu freeglut
  • Ubuntu/Debian: sudo apt install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
  • Windows via MSYS2: pacman -S mingw-w64-x86_64-glfw mingw-w64-x86_64-freeglut
  • MacOS (HomeBrew): brew install glfw freeglut opengl

Compilation & Program

So to compile you can use: g++ 3DCube.cpp -lglfw -lGL -lGLU -lglut -o 3DCube Then just run/start the program/binary: ./3DCube

Screenshots

Cube

Normal cube :3 Cube with Changed Proportions Cube with Changed Proportions.