An odin + sokol renderer project
  • C++ 47.9%
  • C 42.7%
  • Odin 9.1%
  • Shell 0.2%
Find a file
2026-08-09 13:28:29 +02:00
.vscode Added vscode task to build the project 2026-07-22 19:00:22 +02:00
data Reorganized the engine package 2026-08-06 11:09:22 +02:00
docs/images Added doc images, and included screenshots in README.md 2026-07-20 23:56:53 +02:00
sokol Put back sokol-imgui without docking support 2026-08-01 12:12:12 +02:00
src Changed static debug UI label to sliders 2026-08-09 13:28:13 +02:00
.gitignore Ignore .DS_Store files 2026-08-08 18:21:47 +02:00
Makefile Centralized place for resources, and load obj files 2026-07-31 19:48:39 +02:00
ols.json Added new basic setup functions 2026-07-19 09:35:24 +02:00
README.md Added new todo statement 2026-08-09 13:28:29 +02:00

The Frame

An attempt to do something with Sokol and Odin.

Structure

/ shaders # all sokol shaders, compiled with sokol-shdc
/ sokol   # the C code and object libraries to use Sokol in Odin
  / c     # vendored sokol headers + Dear ImGui sources (sokol/c/imgui/)
  / imgui # Dear ImGui integration (debug builds only)
/ src     # the odin code
    / shaders    # generated shaders (see section #shaders)

Platforms

Linux systems, and macOS.

Build

Shaders

make build_shaders

Applications

make build_imgui_libs   # Dear ImGui + sokol_imgui libs (debug builds only)
make build_app_debug   # output: the-frame-debug
make build_app_release # output: the-frame-release

Debug Interface

The debug build (the-frame-debug) ships with a Dear ImGui overlay rendered via sokol_imgui.h.

  • F1 toggles the overlay visibility.
  • The overlay exposes a few controls (show/hide triangle, clear color picker, backend/FPS readouts) — extend the draw_debug_ui proc in src/main.odin to add more debug widgets.
  • Dear ImGui is compiled into the debug binary only; the release binary (the-frame-release) is built without any ImGui code path thanks to when ODIN_DEBUG { ... } gates around every call site.

Dear ImGui versions

  • sokol_imgui.h: pinned to the same master commit as the other vendored sokol headers in sokol/c/.
  • ocornut/imgui vendored under sokol/c/imgui/ (currently v1.92.9 from the master branch).

Setting up ImGui as a git submodule

The ImGui sources are from the master branch. To set up as a proper git submodule:

# Remove existing sources (if present)
rm -rf sokol/c/imgui

# Add as submodule pointing to master branch
git submodule add -b master https://github.com/ocornut/imgui.git sokol/c/imgui
git submodule update --init --remote

# Rebuild ImGui libraries
make build_imgui_libs

Extended ImGui Bindings

The debug UI layer (sokol/imgui/imgui.odin) provides bindings for:

Widgets:

  • Radio buttons: radio_button_bool, radio_button_int
  • Combo boxes: begin_combo, end_combo
  • List boxes: begin_list_box, end_list_box
  • Selectables: selectable, selectable_ptr
  • Input fields: input_text, input_float, input_int
  • Color editors: color_edit3, color_edit4
  • Progress bars: progress_bar
  • Text: separator_text, bullet
  • Layout: same_line, new_line, spacing
  • Disabling: begin_disabled, end_disabled

Hover/Input Detection (for camera control):

  • is_item_hovered, is_window_hovered, is_any_item_hovered
  • is_item_active, is_item_clicked, is_item_focused, is_item_edited
  • is_any_item_active
  • is_mouse_down, is_mouse_clicked, is_mouse_released
  • get_io - access want_capture_mouse, want_capture_keyboard, config_flags

Usage Example (in src/debug.odin):

// Check if ImGui wants mouse input (for camera control)
io: simgui.IO_Simplified
simgui.get_io(&io)
if !io.want_capture_mouse {
    // Process camera input
}

Note: Docking is not supported because sokol_imgui.h is not compatible with the ImGui docking branch.

Screenshots

RGBA triangle

25 rectangles in one render target

TODO

[x] OBJ parser [x] Extended ImGui bindings (widgets, hover detection) [x] 3D objects handling (cube, ball) [x] Apply a transform per object [x] Improve loading models CPU time (reduce GPU buffer creation to one single function) [x] Raycasting to "ping" a scene object using the mouse [x] Load each texture in a thread to improve engine loading time [ ] Fix GLTF parser, and texture / material integration [ ] Serialize a level and its resources in a document format [ ] Display, and improve the debug UI (save a scene, load a scene) [ ] Lua integration [ ] Internal console integration (like Quake console), and lua execution engine [ ] Level editor integrated, with basic object like Player, Enemy (enum), Wall, Input, Output