Skip to content

Instantly share code, notes, and snippets.

@dotbmp
dotbmp / bit_extension.odin
Last active January 18, 2024 15:04
Sign-Extension and Zero-Extension Helpers in Odin
package bit_extension
import "core:intrinsics"
sign_extend :: #force_inline proc "contextless" ($D: typeid, src: $S) -> D where
intrinsics.type_is_integer(D) &&
intrinsics.type_is_integer(S) &&
size_of(D) >= size_of(S)
{
when size_of(S) == size_of(i128) {
@GeezerLMAO
GeezerLMAO / ogmo.odin
Last active January 12, 2024 17:31
Basic Ogmo Loader for Odin
/// Bindings for Ogmo3
package ogmo
import "core:encoding/json"
import "core:log"
import "core:os"
loadProject :: proc(filename: string, allocator := context.allocator) -> (res: Project, ok: bool) {
data, dOk := os.read_entire_file(filename, allocator)
if !dOk {
@gingerBill
gingerBill / microui_raylib_demo.odin
Created October 2, 2021 23:17
microui + raylib Demo in Odin
package microui_raylib
import "core:fmt"
import "core:unicode/utf8"
import rl "vendor:raylib"
import mu "vendor:microui"
state := struct {
mu_ctx: mu.Context,
log_buf: [1<<16]byte,
@mmozeiko
mmozeiko / win32_d3d11.c
Last active October 17, 2024 10:47
setting up and using D3D11 in C
// example how to set up D3D11 rendering on Windows in C
#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d11.h>
#include <dxgi1_3.h>
#include <d3dcompiler.h>
#include <dxgidebug.h>
@d7samurai
d7samurai / .readme.md
Last active October 25, 2024 20:11
Minimal D3D11

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++, OOP or (other) obscuring cruft. View on YouTube

hollowcube

Also check out Minimal D3D11 part 2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 part 3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.