Skip to content

Instantly share code, notes, and snippets.

View btipling's full-sized avatar
:shipit:
shipping code

Bjorn btipling

:shipit:
shipping code
  • ConductorOne
  • Bay Area, California
  • 15:52 (UTC -08:00)
View GitHub Profile
const needle: []const u8 = "layout(bindless_sampler)";
const needle_len: usize = needle.len;
pub fn disableBindless(
bytes: []u8,
locations: []const usize,
) ![]u8 {
var buf: [50]u8 = undefined;
var loc: usize = 0;
@btipling
btipling / gist:90f0b00235f391a5b5e989ee419036fa
Created June 1, 2024 08:57 — forked from Madsy/gist:6980061
Working multi-threading two-context OpenGL example with GLFW 3.0.3 and GLEW 1.8
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <cmath>
#include <cstdio>
#include <limits>
#include <chrono>
#include <thread>
#include <mutex>
@btipling
btipling / troubleshoot.gl.md
Created May 26, 2024 20:16 — forked from deccer/troubleshoot.gl.md
Troubleshoot - OpenGL

i was wondering if we should/could list common errors in the gl get started thing too, after debugcallback/renderdoc chapters or probably in some appendix, if you have more of those, let me know then we can compile those together into some comprehensive unfuck gl list

  • nothing works:

    • get rid of GLCALL/GLCHECK macros, most of them use glGetError incorrectly anyway
    • setup glDebugMessageCallback see here
    • your shaders could contain errors, make sure you check compile and linking state and fix according to what the error was highlighting
  • renderdoc crashes when i try to capture something from my project:

    • most likely some of your code is fucked, its rarely renderdoc being fucked in that case
  • make sure to hookup glDebugMessageCallback as stated above

@btipling
btipling / build.zig
Last active October 6, 2024 01:39
opengl triangle with zig-gamedev
const std = @import("std");
const zsdl = @import("libs/zig-gamedev/libs/zsdl/build.zig");
const zopengl = @import("libs/zig-gamedev/libs/zopengl/build.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "hellotriangle",
@btipling
btipling / set_slack_status.ps1
Last active June 30, 2020 20:14
Setting my slack status via powershell
param ([string] $Status)
function Invoke-SlackRequest([string]$Url, [hashtable]$data, [hashtable]$headers) {
Write-Host "Making a request to slack @ $Url"
$Body = ConvertTo-Json -InputObject $data
Write-Host "Sending body: $Body"
$headers["Content-type"] = "application/json; charset=utf-8";
$result = Invoke-RestMethod -Method 'Post' -Uri $url -Body $body -Headers $headers
if (!$result.ok) {
Write-Error "Not OK!"
@btipling
btipling / foo.json
Last active June 2, 2020 19:53
Just some JSON to parse.
{
"foo": 3,
"bar": 10
}
@btipling
btipling / host.ps1
Created June 2, 2020 07:40
A little toy key value store in PowerShell
PS C:\Users\swart\projects\powershell_scripts> .\name_value_store.ps1
PS C:\Users\swart\projects\powershell_scripts> Add-Data -Name "Foo" -Value 2
PS C:\Users\swart\projects\powershell_scripts> Add-Data -Name "Bar" -Value 8
PS C:\Users\swart\projects\powershell_scripts> Read-Data
Name Value
@btipling
btipling / check_file_exists.ps1
Created May 31, 2020 21:14
A script that prints whether a file exists or not.
param ([string] $Path)
Get-Item -Path $Path -ErrorAction SilentlyContinue -ErrorVariable test | Out-Null
if ($test.Count -eq 0) {
Write-Host "The file at $Path exists!"
}
else {
Write-Host "The file at $Path was not found."
}
@btipling
btipling / params_to_hash.ps1
Last active May 28, 2020 22:21
Demonstrates how to use params, hash tables and convert them into objects and how to use ExpandProperty
param ([string] $name, [int] $value = 0)
$table = @{ Name = $name; Value = $value }
Write-Host "Your table is:"
Write-Output $table
Write-Host "`n"
Write-Host "It has this many items in it: " $table.Count
Write-Host "`n`n"
@btipling
btipling / guess_number.ps1
Created May 27, 2020 21:00
A 1 to 10 number guessing game in PowerShell
function Write-Text([string]$text) {
Write-Host -ForegroundColor Green $text
}
function Remove-Value([int]$value, [int[]]$list) {
[int[]] $new_list = $null
foreach ($v in $list) {
if ($v -ne $value) {
$new_list += $v