Skip to content

Add SDL2 example with custom colorbuffer and font rendering - #179

Open
lzzrhx wants to merge 1 commit into
odin-lang:masterfrom
lzzrhx:sdl2-colorbuffer-and-font-rendering
Open

Add SDL2 example with custom colorbuffer and font rendering#179
lzzrhx wants to merge 1 commit into
odin-lang:masterfrom
lzzrhx:sdl2-colorbuffer-and-font-rendering

Conversation

@lzzrhx

@lzzrhx lzzrhx commented Aug 11, 2026

Copy link
Copy Markdown

This example includes a custom colorbuffer array, some basic functions for drawing to the colorbuffer and functions for font rendering (the font is rendered to a separate colorbuffer, as this allows for only clearing the sections of the buffer that's been drawn to, and thus gives much better performance (since clearing the entire colorbuffer each frame can be quite slow)). The bits for the included font are based on ToshibaSat 8x16. I am not very familiar with how to include licenses properly, but gave it a go in the included LICENSE file.

As an example a procedural Odin logo is drawn to the main colorbuffer.

I've used this setup in two projects:

Checklist before submitting:

  • This example has been added to .github/workflows/check.yml (for automatic testing)
  • This example compiles cleanly with flags -vet -strict-style -vet-tabs -disallow-do -warnings-as-errors
  • This example the naming and style convention: https://github.com/odin-lang/examples/wiki/Naming-and-style-convention (exceptions can be made for ports of examples that need to match 1:1 to the original source).
  • By submitting, I understand that this example is made available under these licenses: Public Domain and Odin's zlib license. Only for third-party dependencies are other licenses allowed.

@lzzrhx lzzrhx changed the title Added SDL2 example with custom colorbuffer and font rendering Add SDL2 example with custom colorbuffer and font rendering Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant