Skip to content

Instantly share code, notes, and snippets.

View DanielShuey's full-sized avatar

DanielShuey

  • Melbourne, Australia
View GitHub Profile
@DanielShuey
DanielShuey / bindless_opengl.c
Last active February 19, 2026 20:54
Bindless OpenGL example (not sure performance)
inline static overload void glsetarg(u32 id, int n, gldt type, const void *ptr, bool normalized) {
glVertexAttribPointer(id, n, type, normalized, 0, ptr);
};
inline static void gltex(texture tex) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(gl_tex2D, 0, gl_rgba, tex.w, tex.h, 0, gl_rgba, gl_u8, &tex.img[0]);
};
mesh m = obj.mesh;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
### Chainable Eval
class Calc
%w(zero one two three four five six seven eight nine divided_by times plus minus).zip((0..9).to_a + %w(/ * + -)) do |d|
define_method(d.first.to_sym) { (@exp ||= []) << d.last; self }
end
define_method(:==) { |expected| eval(@exp.join) == expected }
end