RubikGL is an interactive 3D Rubik's Cube simulator built with OpenGL and CMake. It features customizable cube sizes, face rotations, scrambling, and camera controls. Made to learn more about computer graphics programming using C++ and OpenGL.
- Customizable Cube Size: Generate a Rubik's Cube of any size.
- Face Rotation: Interactively rotate the cube's faces.
- Scrambling: Randomly scramble the cube.
- Camera Controls: Rotate and zoom the camera to view the cube from different perspectives.
- User Interface: Integrated with ImGui for an intuitive user interface.
- CMake (version 3.10 or higher)
-
Clone the repository:
git clone https://github.com/thomascsigai/RubikGL.git cd RubikGL -
Generate Visual Studio project files:
mkdir build cd build cmake .. -
Open the generated solution file:
- Navigate to the
builddirectory. - Open
RubikGL.slnwith Visual Studio.
- Navigate to the
-
Build the project:
- Set the build configuration to
ReleaseorDebug. - Build project
ALL_BUILD(In Solution explorer Right-click onALL_BUILD/ Build).
- Set the build configuration to
-
Set RubikGL as startup project:
- In Solution explorer Right-click on
RubikGL/ Set as startup project
- In Solution explorer Right-click on
-
Run the app:
- Run the
RubikGLproject (F5) - Use the interface to customize the cube, rotate faces, scramble the cube, and adjust the camera.
- Run the
Controls are shown in the controls window, and the cube can be changed in the cube settings window. You may have to move the windows a bit to see all options clearly.
| File | Summary |
|---|---|
Cube.cpp |
Handles the creation and manipulation of the Rubik's Cube. |
GradientBackground.cpp |
Manages the gradient background rendering. |
Main.cpp |
Entry point of the application, initializes and runs the main loop. |
Piece.cpp |
Defines individual pieces of the Rubik's Cube. |
stb_image.cpp |
Third-party library for loading images. |
Window.cpp |
Manages the window creation and input handling. |
Follow the project progress here.
- OpenGL: The core graphics library used for rendering.
- GLFW: For creating windows and handling input.
- GLEW: For managing OpenGL extensions.
- GLM: For mathematical operations.
- ImGui: For the user interface.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions, don't hesitate to contact me.