First install glad here: https://glad.dav1d.de/
- Choose
C/C++. - API gl
Version 3.3. - Profile Compatability
Core. - Under options ensure
Generate a loaderis ticked. - Then click generate and download the zip file.
- Copy
KHRandgladto your compilers include files. - Within your compilers lib files copy over
libglad.a. - Now finally, add
glad.cto your projects source files with yourmain.cppfile.
Now download GLFW here: https://www.glfw.org/download
- Under
Windows pre-compiled binariesselect your version to download in my case its the64-bitversion. - Now unzip this folder.
- Navigate to
liv-vc2022as its the most recent version and copy theglfw3.dllfile into your compilersbinfolder. - Then copy over the
.libfiles into your compilerslibfolder.
Project
│ │ └── include
│ │ ├── KHR
│ │ │ └── khrplatform.h
│ │ └── glad
│ │ └── glad.h
│ └──lib
│ └──only files: .lib (Windows)
│ .a (Linux, lib static)
│ .so (Linus, lib shared)
│
│
main.cpp
glad.c
cmake_minimum_required(VERSION 3.28)
project(OpenGL-tutorial)
set(CMAKE_CXX_STANDARD 17)
# Add executable
add_executable(Graphics main.cpp
glad.c
)
target_link_libraries(Graphics -lfreeglut -lglew32 -lopengl32 glfw3 libglfw3.a)
Graphics Is the parent folder to OpenGL-tutorial.