Code examples for opening windows for various purposes in very few bytes
Go to file
blackle 6ecfc7a26e make switch statement an if statement 2019-06-15 15:42:10 -04:00
Section-Header-Stripper@a4c7aea4f0 Add submodules, better make 2019-04-02 00:17:23 -04:00
noelfver@3022b4ef8b Remove gtk-webkit and replace with sdl2-opengl 2019-06-15 00:26:38 -04:00
vondehi@859c6c11d0 Add submodules, better make 2019-04-02 00:17:23 -04:00
.gitignore Remove gtk-webkit and replace with sdl2-opengl 2019-06-15 00:26:38 -04:00
.gitmodules Remove gtk-webkit and replace with sdl2-opengl 2019-06-15 00:26:38 -04:00
Makefile Fix #1 by adding debug makefile variable 2019-06-15 00:41:56 -04:00
README.md Fix #1 by adding debug makefile variable 2019-06-15 00:41:56 -04:00
gtk-opengl.c Remove gtk-webkit and replace with sdl2-opengl 2019-06-15 00:26:38 -04:00
index.html initialize webgl in a really shitty unoptimized way 2019-04-02 09:58:43 -04:00
index.html.inc woops, forgot index.html.inc 2019-04-02 21:37:36 -04:00
sdl2-opengl.c make switch statement an if statement 2019-06-15 15:42:10 -04:00
shader.frag Remove iTime from shaders, render each only once 2019-04-02 10:05:13 -04:00
shader_minifier.exe Opengl with gtk example 2019-04-02 00:43:08 -04:00
xlib-opengl.c Sizecode xlib a bit 2019-04-02 01:15:52 -04:00

README.md

Linux-OpenGL-Examples

Here are examples of rendering a shader full screen on linux. All of these examples do it in less than 2 kilobytes thanks to vondehi and copious amounts of ELF stripping.

There are three examples, each using a different library to open a window and get an opengl context.

xlib-opengl - 1492 bytes

Vanilla xlib is the largest of the bunch and the most brittle. It is highly not recommended to use xlib in a demo unless you cannot assume these other libraries will be on the system. (note, unlike all the other programs that close with the window manager's quit key combination, this program must be closed with ESC.)

gtk-opengl - 1382 bytes

GTK is a step up from xlib, being both smaller and more robust. If the compo you are entering doesn't allow using SDL2, GTK is an ok alternative. Before switching to GCC 8.3.0, this was 100 bytes smaller than it is now. I am not sure why it is larger, but this likely means it can be sizecoded/stripped further.

sdl2-opengl - 996 bytes

Using SDL2 will give you very small binaries. Use SDL2 whenever you can, as it also has a few other useful subsystems at minimal cost (for example, audio.)