Examples
February 18, 2026 ยท View on GitHub
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.
Building
They all require SDL2 to be installed to build.
On Debian/Ubuntu based distributions you can install SDL2 using the following command:
sudo apt install libsdl2-dev
On Mac you can download the DMG file from their releases page or install it through a package manager like Homebrew, MacPorts, or Fink. Note, I do not own a mac and have never tested PortableGL on one. Worst case, you can always just compile SDL2 from source but one of the above options should work.
On Windows you can grab the zip you want from the same releases page linked above.
I use premake generated makefiles that I include in the repo which I use on Linux. I have used these same Makefiles to build under MSYS2 on Windows. However, at least for now, even though PortableGL and all the examples and demos are cross platform, I don't officially support building them on other platforms. I've thought about removing the premake scripts from the repo entirely and just leaving the Makefiles to make that clearer but decided not to for the benefit of those who want to modify it for themselves to handle different platforms and build systems. For now the win32 backend examples will have to suffice.
Once you have SDL2 installed you should be able to cd into each subdirectory and 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.
Original Custom Examples
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 |
Classic Ports
Ports of classic OpenGL programs/demos
| example | image | last version updated | original developer |
|---|---|---|---|
| gears | ![]() | 0.100.0 | Robert Winkler |
Learning WebGL ports
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 |
Learn OpenGL ports
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 out of a total of about 97 programs over 8 chapters. It's mostly stalled there until PGL officially adds certain features like more texture formats, FBOs, etc. 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 |

























