A platform agnostic quick start project for graphics programming with OpenGL and GLFW
- Create a
/vendors
folder somewhere on your disk - Download the
glfw
andglad
source. Forglad
choose the OpenGL version of your liking and selectcore
mode. Scroll down and click generate. Then download theglad.zip
file. - Unzip both
glfw
andglad
into your/vendors
folder. The file structure should look something like this: (For example on WIN64)
C:\DEV\VENDORS
├───glad
└───glfw-3.4
- Update the
EXE_NAME
variable inCMakeLists.txt
to whatever you want to name your exe. - Set your
VENDORS
variable inCMakeLists.txt
to where your vendors folder is. On Linux and Macos you can navigate to your vendors folder and typepwd
to get the absolute path. Note that this path must be an ABSOLUTE PATH. On WIN64 you can copy the path from the file explorer. Make sure that you use forward slashes in the WIN64 path. - Configure whether you want to use
C
orC++
inCMakeLists.txt
- If you are on MacOS,
CMakeLists.txt
is defaulted to generating a make file for the M series macs. If you want to compile for an Intel machine while on an M series architecture, you should uncomment the line:set(INTEL_APPLE 1)
To generate the make files or the project solution on windows navigate to the project root folder and type the following command in a terminal / command prompt (WIN64).
mkdir build
cd build
cmake ..
On Unix based systems you can then run the make
command to build your project and then ./your-exe-name
to run your exe.
On WIN64 you'll want to open your-exe-name.sln
in Visual Studio. You an then build the exe by right clicking the project in the solution explorer and hitting build / rebuild.
If you get a warning about the source being from way in the future thats probably because the server that glad uses to generate the files is ahead of your time zone. When your time zone catches up to the time the file was generated the warnings will go away but you can also open glad.h and glad.c and save the files. That will override the time metadata to your time zone