HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
floooh
sokol-samples
C2019–2026
floooh / sokol-samples

sokol-samples

Sample code for https://github.com/floooh/sokol

3Distinct people
19Mentions
0Explicit recommenders
810GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Sample code for https://github.com/floooh/sokol

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 4:00:59 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year19 dated mentions

Observed mentions: 2019-03-07 14:25:33 UTC to 2026-09-30 15:56:14 UTC.

02462019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC707

What Hacker News says

7 sources
Slug doesn't use "bitmap" font data but more like parameter lookup tables in storage buffers, pre-processed from TTF files. The lookup data can of course also live in textures (so that it works in WebGL), but using those textures as "poor-man's storage buffers", e.g. fetching the data directly without filtering. The pixel shader is indeed quite complex compared to SDF: https://github.com/floooh/sokol-samples/blob/8afa83928ce1870...
In SDF vs. MSDF vs. Slug: GPU Text Rendering
Here's a simple Slug rendering example on top of sokol_gfx.h: via WebGPU backend: https://floooh.github.io/sokol-webgpu/slug-sapp.html via WebGL2 backend: https://floooh.github.io/sokol-html5/slug-sapp.html There's quite a bit of helper code plus stb_truetype.h and stb_ds.h under the hood to parse TTF files and crunch the TTF curve data into the runtime format expected by the Slug shader (this stuff should better go into an offline asset pipeline tool): https://github.com/floooh/sokol-samples/blob/master/libs/slu... ...the actual text rendering code is also taking a couple of shortcuts, e.g. no kerning, no right-to-left, and also no text shaping. There's also a new and complete text rendering stack by Mikko Mononen called Skribidi (AFAIK not based on Slug though): https://github.com/memononen/Skribidi ...the list of external dependencies
Read the rest
is a bit scary for a small self-contained sample though (Harfbuzz, SheenBidi, libunibreak, etc...), but that basically shows that proper international text rendering is really damn hard, even when trying to simplify the code as much as possible.
In SDF vs. MSDF vs. Slug: GPU Text Rendering
I wrote a little demo to run microui on top of the sokol headers here, it's really interesting in how minimal it is. WASM demo: https://floooh.github.io/sokol-html5/sgl-microui-sapp.html Source code: https://github.com/floooh/sokol-samples/blob/master/sapp/sgl... The renderer backend is just a bunch of C functions you need to provide: https://github.com/floooh/sokol-samples/blob/3f4185a8578cd2b... It's also interesting to compare the binary sizes: microui sample (https://floooh.github.io/sokol-html5/sgl-microui-sapp.html): 79.6 KBytes compressed download Nuklear sample (https://floooh.github.io/sokol-html5/nuklear-sapp.html): 155 kb compressed download Dear ImGui sample (https://floooh.github.io/sokol-html5/imgui-sapp.html): 491 KB compressed download
In MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C
> ImGui has C++ API as first-class citizen Dear ImGui via the C bindings is actually quite nice and not much less convenient than the C++ API (the only notable difference is that the C API has no overloads and default params). E.g. here's a control panel UI (from the below ozz-animation sample) with the 'Dear Bindings' approach (using a custom 'ig' prefix)): https://github.com/floooh/sokol-samples/blob/d8429d701eb7a8c... Dear ImGui is a bit of an outlier for C++ libraries though, since it is essentially a C API wrapped in a namespace. OzzAnimation is also fairly trivial to wrap in an (abstracted) C API, for instance I use this in some of the sokol-samples: https://github.com/floooh/sokol-samples/blob/master/libs/ozz... Implementation: https://github.com/floooh/sokol-samples/blob/master/libs/ozz... ...used in this sample: https://github.co
Read the rest
m/floooh/sokol-samples/blob/master/sapp/shd... ...WASM live version: https://floooh.github.io/sokol-html5/shdfeatures-sapp.html TL;DR: quite a few C++ libraries out of the game-dev world are actually quite easy to access from C or languages that can talk to C APIs, mainly because the game-dev world typically uses a very 'orthodox' subset of C++ (no or very restricted C++ stdlib usage, no rtti, no exceptions, ideally no smart pointers in the public API).
In Testing the Swift C compatibility with Raylib (+WASM)
Any language feature added in C99 and later. In GCC and Clang it's quite relaxed since their C++ frontends pull in a couple of modern C features as non-standard C++ extensions, but MSVC has a strict separation between the C++ and C frontend and doesn't allow this sort of 'cross-pollution'. As a quick example, this C99 code block has at least 4 features that don't work in C++: https://github.com/floooh/sokol-samples/blob/91bd8c6f9f52149... - taking the address of an adhoc-created struct in a function call - random array access in struct initialization - designator chaining in struct initialization - designators can be out-of-order in C but not C++ ...also using unions as different views on the same memory is actually useful sometimes.
In Why Objective-C
I don't know sorry. For debugging GL I usually switch to Windows with RenderDoc (or some current NVIDIA tool - does Nsight still exist?). RenderDoc on Linux appears to work fine for X11 apps via XWayland btw (just testing here via the sokol-samples with the sokol-gfx GL backend: https://github.com/floooh/sokol-samples, just another reason to not have a native Wayland backend but instead rely on the XWayland shim I guess...
In Ask HN: DDD was a great debugger – what would a modern equivalent look like?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.