This repository provides a boilerplate for OpenGL project with GLFW, GLAD, GLM, SOIL and FreeType on Windows with MinGW. It also provides a
.vscode/c_cpp_properties.json
file for VSCode.
This is the structure of the boilerplate.
.
├─.vscode
├─external
│ ├─freetype
│ │ ├─include
│ │ └─lib
│ ├─glad
│ │ ├─include
│ │ └─src
│ ├─glfw
│ │ ├─include
│ │ └─lib
│ ├─glm
│ │ └─glm
│ └─soil
│ ├─include
│ └─lib
└─src
We will need GLAD
, GLFW
, GLM
, SOIL
and FreeType
for our project. We have already placed GLFW
(version 3.3.2), GLAD
(verison 4.3) and GLM
(version 0.9.9.8) files under the external
folder. We have also re-compiled SOIL (version July 7, 2008) and compiled FreeType (version 2.10.2) using MinGW to fit our environment, and placed their files likewise.
If you want libraries of certain versions, you can still keep the structure of this project, and go here to download the pre-compiled binaries of GLFW, go here to generate GLAD source of your preferred version, go here to download GLM, and go here to download GLM.
You will need to place your own source files under the src
folder. We have placed a simple file which will create a window.
We suggest using VSCode with C/C++ and CMake Tools extension so that you can build or debug simply by just clicking buttons in the status bar after proper configuration.
Of course you can also run:
# create build directory and move to it
mkdir build
cd build
# configure project
cmake -G"MSYS Makefiles" ../ # or "MinGW Makefiles" depending on your type of `make`
# build executables
make # or `cmake --build ./`
The generated executable will be placed at build/bin
.