Skip to content

Instantly share code, notes, and snippets.

View rtv's full-sized avatar

Richard Vaughan rtv

View GitHub Profile

Keybase proof

I hereby claim:

  • I am rtv on github.
  • I am rtv (https://keybase.io/rtv) on keybase.
  • I have a public key ASAPYd-tmLboqK9c0H3OROame9VA2CJCkZw_k1VhsWJ4ggo

To claim this, I am signing this object:

@rtv
rtv / texture.c
Created August 18, 2016 17:48
Old-school OpenGL to draw a grey-level image texture between four 3D points.
/*
Draws a grey-level image between four 3D points.
@pixels points to an array of @cols*@rows grey values.
@tl[x,y,z] 3D coordinate for top-left image pixel
@tr[x,y,z] 3D coordinate top-right
@bl[x,y,z] 3D coordinate bottom-left
@tr[x,y,z] 3D coordinate bottom-right
@rtv
rtv / cond.c
Created February 19, 2013 19:56
An example of using pthread's condition variables, showing how to block a main thread while waiting for worker threads to finish their work, without joining the threads. This could be useful if you want to loop the threads, for example.
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
/* Compile like this:
gcc --std=c99 -lpthread cond.c -o cond