A C++/OpenGL Graphics Toy, it might be useful when you learning Computer Graphics
Model
.obj/.mtl
Rendering
- Blinn-Phong
This project is configured for Windows 10 64 bit & CLion 2022.3.1. If you are using a highly differentiated platform (Such as Linux or MacOS) or toolchain (Such as MSVC), the CMakeLists.txt
and other 3rd packages may not work properly.
mkdir build && cd build
("&&" operator need Windows PowerShell 7 or higher version, If your PowerShell not support it, you may split this command intomkdir build
andcd build
)cmake -G Ninja ..
ninja
Then, you'll find a executable file named MeshViewer.exe
and a Dynamic Linking Library named glfw3.dll
in the build
folder. This is what you have build.
Currently, the shader & resource path is hard-coded in main.cpp
, to make the program run correctly, the architecture of your directory should be like the below:
- MeshViewer (any folder name you like will also be ok)
- MeshViewer.exe
- glfw3.dll
- models (hard-coded now, so do not modify the name of directory and files )
- src
- shader (hard-coded now, so do not modify the name of directory and files )
- Glad, Multi-Language GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs, https://glad.dav1d.de/
- GLFW, an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop, https://www.glfw.org/
- Eigen, a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms, https://gitlab.com/libeigen/eigen
- OBJ-Loader, A C++ OBJ Model Loader that will parse .obj & .mtl Files into Indices, Vertices, Materials, and Mesh Structures, https://github.com/Bly7/OBJ-Loader, I modified some of them to support more descriptions in the obj file, the new code follows the license of this project.
- stb, single-file public domain(or MIT License) libraries for C/C++, https://github.com/nothings/stb
- Dear Imgui, Bloat-free Graphical User interface for C++ with minimal dependencies, https://github.com/ocornut/imgui
-
Lumine (Genshin Impact), OBJ 3D Model, https://www.models-resource.com/pc_computer/genshinimpact/model/45957/
-
Stanford Bunny, OBJ 3D Model, Generated by MeshLab, Data from http://graphics.stanford.edu/data/3Dscanrep/
-
Box Stack,OBJ 3D Model, https://github.com/Bly7/OBJ-Loader/tree/master/examples/1%20-%20LoadAndPrint
-
Cube, OBJ 3D Model, Handmade by myself