A ShaderToy's Demo by Inigo Quilez in a single main.c file
- glut (or freeglut)
- glew (Windows only)
- Linux: gcc -O2 main.c -o 3D_Signed_Distance_Shapes_Demo -lglut -lGL -lX11 -lm
- Windows: cl /O2 /MT /Tc main.c /D"GLEW_STATIC" /link /out:3D_Signed_Distance_Shapes_Demo.exe glut32.lib glew32s.lib opengl32.lib gdi32.lib Shell32.lib comdlg32.lib user32.lib kernel32.lib
- Emscripten: emcc -O2 -fno-rtti -fno-exceptions -o 3D_Signed_Distance_Shapes_Demo.html main.c --preload-file signed_distance_shapes.glsl -I"./" -s LEGACY_GL_EMULATION=0 --closure 1
- Mac: ???
Optionally -D"WRITE_DEPTH_VALUE" (or /D"WRITE_DEPTH_VALUE") can be added to the command lines above, to mix sphere-cast rendering and normal polygon rendering (in Emscripten it uses the GL_EXT_frag_depth extension).