Different collections of sample programs, some original, lots of ports. Also I shamelessly borrowed the table format and organization from the excellent raylib library I can only aspire to raylib's polish.
I use premake5 generated Makefiles that I include in the repo which I use on Linux, but first SDL2 needs to be installed.
On Debian/Ubuntu based distributions you can install SDL2 using the following command:
sudo apt install libsdl2-dev
Once you have SDL2 installed you should be able to run make or make config=release for optimized builds.
make verbose=1 will let you see all the build steps. You can run make help to see all the individual targets.
You can run ../tools/windows/premake5.exe vs2022 to generate Visual Studio 2022 project files. They use the vendored
SDL2 in external/SDL2 so they should build right out of the box. Premake5 supports vs2005 through vs2026 but I've
only tested vs2022 personally.
If you prefer the Linux workflow, I have also used the included Makefiles to build under MSYS2 on Windows. They should also work under WSL.
You can install SDL2 through a package manager like Homebrew, MacPorts, or Fink.
Once you have SDL2 installed, run the appropriate version of included premake5 binary to generate an xcode project:
../tools/mac/arm/premake5 xcode4 or ../tools/mac/x64/premake5 xcode4.
The exercises are a small collection demonstrating the basics in C and C++ and how to use the built in shader library. The C++ versions use own rsw_math rather than glm like most of the other C++ examples. The rest are just whatever makes its way over here from demos as I polish them up.
| example | image | last version updated |
original developer |
|---|---|---|---|
| ex1.c | ![]() |
0.100.0 | Robert Winkler |
| ex2.c | ![]() |
0.100.0 | Robert Winkler |
| ex3.c | ![]() |
0.100.0 | Robert Winkler |
| ex1.cpp | ![]() |
0.100.0 | Robert Winkler |
| ex2.cpp | ![]() |
0.100.0 | Robert Winkler |
| ex3.cpp | ![]() |
0.100.0 | Robert Winkler |
| ex1_std_shaders.c | ![]() |
0.100.0 | Robert Winkler |
| ex2_std_shaders.c | ![]() |
0.100.0 | Robert Winkler |
Ports of classic OpenGL programs/demos
| example | image | last version updated |
original developer |
|---|---|---|---|
| gears | ![]() |
0.100.0 | Robert Winkler |
Ports of lessons from learningwebgl.com based off of my own ports to OpenGL 3.3 here.
| example | image | last version updated |
original developer |
|---|---|---|---|
| lesson1 | ![]() |
0.100.0 | Robert Winkler |
| lesson2 | ![]() |
0.100.0 | Robert Winkler |
| lesson3 | ![]() |
0.100.0 | Robert Winkler |
| lesson4 | ![]() |
0.100.0 | Robert Winkler |
| lesson5 | ![]() |
0.100.0 | Robert Winkler |
| lesson6 | ![]() |
0.100.0 | Robert Winkler |
| lesson7 | ![]() |
0.100.0 | Robert Winkler |
| lesson8 | ![]() |
0.100.0 | Robert Winkler |
| lesson9 | ![]() |
0.100.0 | Robert Winkler |
| lesson10 | ![]() |
0.100.0 | Robert Winkler |
| lesson11 | ![]() |
0.100.0 | Robert Winkler |
| lesson12 | ![]() |
0.100.0 | Robert Winkler |
| lesson13 | ![]() |
0.100.0 | Robert Winkler |
| lesson14 | ![]() |
0.100.0 | Robert Winkler |
| lesson15 | ![]() |
0.100.0 | Robert Winkler |
| lesson16 | ![]() |
0.100.0 | Robert Winkler |
Ports of learnopengl.com tutorial code here.
These are probably the cleanest and most polished examples because they were already OpenGL 3.3 so the porting process was relatively easy with minimal changes necessary.
The project is too large to include here and works best as a separate repo anyway. I've currently ported the first 4 chapters worth, or about 56 programs out of a total of about 97 programs over 8 chapters. Progress on later chapters was long blocked on missing PGL features; FBOs, MRT, float textures, and related RTT support are now in PortableGL, so more advanced OpenGL tutorial ports are unblocked from that side (remaining work is still mostly porting time and any gaps that show up case by case). I've included a few below as a sampling.
| example | image | last version updated |
original developer |
|---|---|---|---|
| spotlight | ![]() |
0.100.0 | Robert Winkler |
| model_loading | ![]() |
0.100.0 | Robert Winkler |
| depth_testing_view | ![]() |
0.100.0 | Robert Winkler |
| stencil_testing | ![]() |
0.100.0 | Robert Winkler |
| blending_discard | ![]() |
0.100.0 | Robert Winkler |
| blending_sorted | ![]() |
0.100.0 | Robert Winkler |

























