Skip to content
/ scop Public

Scop is a 42 Post-Common Core project focused on low-level graphics programming using OpenGL. It involves building a simple 3D OBJ viewer with texture support and real-time rotation on all axes.

License

Notifications You must be signed in to change notification settings

Vpekdas/scop

Repository files navigation

Scop

Screenshots

scop.mp4

Table of Contents

  1. Description
  2. Installation
  3. Run
  4. Credits
  5. Contributing
  6. License

Description

Scop is a project from the 42 Post-Common Core curriculum, designed to introduce students to low-level graphics programming using APIs like Vulkan or OpenGL.

Purpose

The objective is to create a simple 3D OBJ renderer that displays textures and can rotate along all three axes.

Controls

Key Action
X Rotate model around X-axis
Y Rotate model around Y-axis
Z Rotate model around Z-axis
Space Pause rotation
Rotate right
Rotate left
T Enable texture mode
F Enable face mode
F1 Switch to point mode
F2 Switch to line mode
F3 Switch to fill mode
ESC or click the X (top-right corner) Exit

Technologies used

  • C++: The primary programming language for the project.
  • CMake: A tool for managing the build process.
  • GLSL: The shading language used for writing shaders.
  • OpenGL: The graphics API for rendering the 3D model and textures.

Challenges and Future Features

The main challenges in this project were learning how graphics APIs, like OpenGL, work. Initially, I struggled to understand why triangles are the preferred primitive for rendering. The difficulty increased when I had to render the triangle by creating an index buffer, vertex arrays, and setting up vertex attribute pointers. After that, I moved on to creating a cube and implementing rotations along all three axes.

Before tackling these challenges, I also had to learn some basic mathematics, such as understanding matrices, how they work, and how they are used in 3D graphics.

I'm not planning to add new features.

Installation

  • Ensure you have a C compiler installed, such as Clang or GCC
clang --version
gcc --version
  • Ensure you have installed CMake to build the project
cmake --version
  • Create a build folder to organize the build files:
mkdir build
  • Generate build files with CMake:
cmake -S . -B build/Release -DCMAKE_BUILD_TYPE=RELEASE
  • Build the project using CMake:
cmake --build build/Release --config Release

Note

On macOS, OpenGL is deprecated, so you might encounter warnings during the build process. However, these warnings do not cause any issues and can be safely ignored.

Run

  • To run the program, provide the path to an OBJ model and its corresponding TGA texture file as arguments:
./build/Release/scop [./assets/models/.obj] [./assets/textures/.tga]

Credits

  • FirePh0enix: Thanks for your help in choosing an API and advising that OpenGL would be easier to learn. Also, for explaining the basics of matrices and fan triangulation

  • The Cherno: Thanks for his great videos on OpenGL and, overall, for sharing his knowledge on C++ and game engine development!

Contributing

To report issues, please create an issue here: issue tracker.

If you'd like to contribute, please follow the steps outlined in CONTRIBUTING.md.

License

This project is licensed under the MIT License.

Third-Party Licenses

About

Scop is a 42 Post-Common Core project focused on low-level graphics programming using OpenGL. It involves building a simple 3D OBJ viewer with texture support and real-time rotation on all axes.

Resources

License

Contributing

Stars

Watchers

Forks