Skip to content

Latest commit

 

History

History
113 lines (81 loc) · 9.05 KB

File metadata and controls

113 lines (81 loc) · 9.05 KB

Examples

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

Linux

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.

Windows

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.

Mac

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.

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 ex1 0.100.0 Robert Winkler
ex2.c ex2 0.100.0 Robert Winkler
ex3.c ex3 0.100.0 Robert Winkler
ex1.cpp ex1_cpp 0.100.0 Robert Winkler
ex2.cpp ex2_cpp 0.100.0 Robert Winkler
ex3.cpp ex3_cpp 0.100.0 Robert Winkler
ex1_std_shaders.c ex1_std_shaders 0.100.0 Robert Winkler
ex2_std_shaders.c ex2_std_shaders 0.100.0 Robert Winkler

Classic Ports

Ports of classic OpenGL programs/demos

example image last version
updated
original
developer
gears 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 lesson1 0.100.0 Robert Winkler
lesson2 lesson2 0.100.0 Robert Winkler
lesson3 lesson3 0.100.0 Robert Winkler
lesson4 lesson4 0.100.0 Robert Winkler
lesson5 lesson5 0.100.0 Robert Winkler
lesson6 lesson6 0.100.0 Robert Winkler
lesson7 lesson7 0.100.0 Robert Winkler
lesson8 lesson8 0.100.0 Robert Winkler
lesson9 lesson9 0.100.0 Robert Winkler
lesson10 lesson10 0.100.0 Robert Winkler
lesson11 lesson11 0.100.0 Robert Winkler
lesson12 lesson12 0.100.0 Robert Winkler
lesson13 lesson13 0.100.0 Robert Winkler
lesson14 lesson14 0.100.0 Robert Winkler
lesson15 lesson15 0.100.0 Robert Winkler
lesson16 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 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 spotlight 0.100.0 Robert Winkler
model_loading backpack_model 0.100.0 Robert Winkler
depth_testing_view depth_testing_view 0.100.0 Robert Winkler
stencil_testing stencil_testing 0.100.0 Robert Winkler
blending_discard blending_discard 0.100.0 Robert Winkler
blending_sorted blending_sorted 0.100.0 Robert Winkler