This series of demos accompanies the e-book "Anton's OpenGL 4 Tutorials": antongerdelan.net/opengl
Anton Gerdelan email: antonofnote AT gmail
See "LICENCE.txt" for licence information.
Each chapter with major demonstration code has a corresponding demo here. There is also an example of code for Hello Triangle for OpenGL 2.1 for reference.
Each demo has easy-to-read Makefiles for Linux, MacOS, and Windows.
You may need to download newer versions of the libraries in the
This code is some years old now and builds may fall out of date. I try to maintain this so that it functions but be aware that Makefiles and build details may differ slightly from book text for this reason. If you have a tidy CMake setup or updated build feel free to submit a pull request here.
The libraries depended on reside in the common/ folder
common/include- Header files.
common/linux_i386- 32-bit GNU/Linux libraries.
common/linux_x86_64- 64-bit GNU/Linux libraries.
common/osx_64- 64-bit Apple macOS libraries.
common/win32- 32-bit Windows GCC (MinGW) libraries.
common/win64_gcc- 64-bit Windows GCC (MinGW-w64) libraries.
sudo apt-get install build-essential
sudo apt-get install libglfw3-dev sudo apt-get install libfreetype6-dev
make -f Makefile.linux64
make -f Makefile.linux32
cdto the demo of choice:
make -f Makefile.osx
cdto the demo of choice.
make -f Makefile.win32(MinGW may have renamed
make -f Makefile.win64for the 64-bit build.
If you have trouble linking supporting libraries you may need to recompile GLFW, GLEW, AssImp, and Freetype. It's a good idea to do this anyway to stay up to date.
The original Visual Studio solution has gone out of date now, so I removed it. I have instead recorded a 2020 video stream tutorial where I show how to get Visual Studio set up and start programming OpenGL, including downloading and setting up libraries.
This includes a very verbose set-up of Visual Studio 2019 with helper libraries.
gl_utils.cppto avoid cluttering
main.cpp. This means that
gl_utils.cppis not necessarily the same in each demo, but is built up gradually.
Special thanks to all the readers over the years that have submitted additions, bug reports, fixes, and feedback. If you have submitted a correction and don't mind having your name/@ printed here please let me know (or if you'd like to change these details).