This project has been created as part of the 42 curriculum by quannguy.
Scop is a lightweight 3D rendering project developed as part of the 42 curriculum. The goal of the project is to create a simple and efficient application capable of loading and displaying 3D models stored in the Wavefront .obj format.
The project is written in C++ and uses OpenGL for hardware-accelerated rendering. It includes support for .mtl material files, shader-based rendering, and basic camera controls for interacting with the 3D scene.
The main objectives of the project are to understand and implement fundamental concepts related to:
3D model parsing and representation. OpenGL rendering. Vertex and fragment shaders. Camera movement and transformations. Mesh and material handling. Coordinate systems and 3D mathematics. User input and real-time interaction. Scop provides a minimal environment for loading an OBJ model and viewing it interactively in a 3D window.
- Load and render
.objfiles. - Support for
.mtlmaterial files. - Basic camera controls for navigating the 3D scene.
- Shader-based rendering pipeline.
- Lightweight and easy to use.
scop/
├── .gitignore
├── CMakeLists.txt
├── lsan.supp
├── build/
├── glad/
│ ├── include/
│ │ ├── glad/
│ │ │ └── glad.h
│ │ └── KHR/
│ │ │ └── khrplatform.h
│ └── src/
│ └── glad.c
├── inc/
│ ├── MathUtils.hpp
│ ├── scop.hpp
│ └── class/
│ ├── Camera.hpp
│ ├── CameraControl.hpp
│ ├── GameObject.hpp
│ ├── Mesh.hpp
│ ├── Shader.hpp
│ ├── Transform.hpp
│ └── Window.hpp
├── obj/
├── resources/
│ ├── 42.obj
│ ├── 42.mtl
│ ├── teapot2.obj
│ └── teapot2.mtl
├── shaders/
│ ├── fragment.glsl
│ └── vertex.glsl
└── src/
├── CameraControl.cpp
├── GameObject.cpp
├── main.cpp
├── MathUtils.cpp
├── Mesh.cpp
├── parse.cpp
├── processInput.cpp
├── Shader.cpp
├── Transform.cpp
└── Window.cpp
- A C++ compiler that supports C++17 or later.
- OpenGL development libraries.
- CMake.
-
Clone the repository:
git clone https://github.com/Inzagini/scop.git cd scop -
Configure and build the project with CMake:
cmake -S . -B build cmake --build build -
Run the application:
./build/scop [path to .obj file]
- Place your
.objand.mtlfiles in theresources/directory or anywhere else. - Run the application and provide the path to the
.objfile as a command-line argument:./build/scop resources/your_model.obj
- Use the following controls to navigate the 3D scene:
W,A,S,D: Move the object.Q/E: Rotate the object around Y.- Arrow keys: Rotate the object around X / Z.
Space: Re-centre the object.- Left mouse drag: Rotate the object.
- Middle mouse drag: Orbit the camera.
- Mouse scroll: Zoom in and out (hold
Ctrlfor 10x faster). F: Toggle the coloured/textured view.G: Toggle the triangle wireframe (raw view only).T: Toggle auto-rotate.- Click the
?button: Toggle the on-screen controls legend. Esc: Exit the application.
src/: Contains the source code for the project.inc/: Header files for the project.glad/: OpenGL loader library.shaders/: Vertex and fragment shaders for rendering.resources/: Example.objand.mtlfiles.CMake:CMake configuration used to configure and build the project.build/: Generated build directory created by CMake. It should not be committed to the repository.obj/: Additional object/build-related files, if generated or used by the project.lsan.supp: LeakSanitizer suppression configuration for imported libary.
AI tools were used as an auxiliary resource during the development of this project.
AI assistance was used for tasks such as:
- Clarifying OpenGL and C++ concepts when documentation or existing resources were difficult to understand.
- Explaining shader concepts and the rendering pipeline.
- Helping with the migration from a Makefile-based build system to CMake.
- Improving and structuring project documentation, including this README.
This project is licensed under the MIT License. See the LICENSE file for details.
- GLM - OpenGL Mathematics library.
- GLAD - OpenGL loader generator.
- LearnOpenGL - For tutorials and resources on OpenGL.
- 42 - For the curriculum and project requirements.
Happy rendering! 🎉
