This project demonstrates a basic 3D graphics scene using OpenGL and GLUT (OpenGL Utility Toolkit) in C. The scene includes a cube that can be manipulated using keyboard inputs to move, scale, and rotate. The project utilizes lighting effects, including ambient light and a spotlight.
- 3D cube rendering with various transformations (translation, rotation, scaling).
- User-controlled camera with movement in different directions.
- Lighting effects, including ambient light and a spotlight.
- Information display on keypress events.
- Simple and intuitive keyboard controls.
Follow the steps below to compile and run the project:
-
Ensure you have the necessary dependencies installed:
- OpenGL
- GLUT (OpenGL Utility Toolkit)
- SOIL2 (Simple OpenGL Image Library)
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd 3D-Graphics-Project
-
Compile the project using a C compiler (e.g., GCC):
gcc -o 3DGraphicsProject main.c -lGL -lGLU -lglut -lSOIL2 -lm
-
Run the compiled executable:
./3DGraphicsProject
- Up Arrow: Move the cube up (with different effects based on modifiers).
- Down Arrow: Move the cube down (with different effects based on modifiers).
- Left Arrow: Move the cube to the left.
- Right Arrow: Move the cube to the right.
- W: Move the cube up.
- A: Move the cube to the left.
- S: Move the cube down.
- D: Move the cube to the right.
- Alt + Up Arrow/Down Arrow/Left Arrow/Right Arrow: Rotate the camera (with different effects based on modifiers).
- Shift + Up Arrow/Down Arrow: Zoom in/out (affecting camera position or cube scaling).
- Ctrl + Up Arrow/Down Arrow: Scale up/down the cube.
- OpenGL: Cross-platform 3D graphics API.
- GLUT (OpenGL Utility Toolkit): Toolkit for creating OpenGL applications.
- SOIL2 (Simple OpenGL Image Library): Library for loading image files.
This project is licensed under the MIT License - see the LICENSE file for details.