Skip to content

Instantly share code, notes, and snippets.

View laytan's full-sized avatar

Laytan laytan

  • The Netherlands
  • 06:17 (UTC +02:00)
  • X @laytanl_
View GitHub Profile
@laytan
laytan / compile.sh
Last active March 6, 2026 11:01
Odin, GLFW & Vulkan boilerplate for Drawing a Triangle on https://vulkan-tutorial.com
#!/usr/bin/env sh
glslc shader.vert -o vert.spv
glslc shader.frag -o frag.spv
@laytan
laytan / main.odin
Created March 18, 2024 21:44
Odin GLFW 3.4 Hello World
package main
import "core:log"
import "core:mem"
import "core:runtime"
import "vendor:glfw"
import gl "vendor:OpenGL"
main :: proc() {
@laytan
laytan / main.odin
Created April 10, 2024 22:57
Stack traces using Odin instrumentation features
package main
import "core:runtime"
main :: proc() {
context.assertion_failure_proc = print_call_frames
foo()
}
@laytan
laytan / main.odin
Last active August 21, 2025 09:44
Graphviz Odin dependencies
package main
import "core:fmt"
import "core:io"
import "core:odin/ast"
import "core:odin/parser"
import "core:os"
import "core:path/filepath"
import "core:slice"
import "core:strings"
@laytan
laytan / LICENSE
Last active January 24, 2026 17:52
LLDB script to visualise Odin slices, maps, and strings
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
@laytan
laytan / rlights.odin
Created June 20, 2024 15:33
rlights port
package rlights
import rl "vendor:raylib"
MAX_LIGHTS :: 4
Light :: struct {
type: LightType,
enabled: b32,
position: [3]f32,
@laytan
laytan / Makefile
Created June 30, 2024 21:11
Odin with C entry point
program: entry.c program.odin
odin build . -out:program -no-entry-point -build-mode:object
clang entry.c program.o -o program
rm program.o
@laytan
laytan / renderer.odin
Last active November 2, 2025 13:45
Example Odin font renderer using fontstash and WebGPU
package vendor_wgpu_example_fontstash
import intr "base:intrinsics"
import "core:fmt"
import "core:math/linalg"
import sa "core:container/small_array"
import fs "vendor:fontstash"
import "vendor:wgpu"
@laytan
laytan / raw.odin
Last active August 29, 2024 17:36
Odin raw mode terminal
package main
import "core:c/libc"
import "core:fmt"
import "core:io"
import "core:os"
import "core:time"
import "core:unicode/utf8"
@(require)
@laytan
laytan / deep.odin
Created September 6, 2024 18:58
Odin Deep Clone (WIP)
deep_clone :: proc(value: $T, allocator := context.allocator, temp_allocator := context.temp_allocator) -> (clone: T) {
internal_deep_clone :: proc(value: any, clone: any, ptrs: ^map[rawptr]rawptr) {
// Forgive me father for I have sinned.
using reflect
value_core := any_core(value)
clone_core := any_core(clone)
assert(value_core.id == clone_core.id)
fti := type_info_of(value_core.id)