Skip to content

Instantly share code, notes, and snippets.

View joelpryde's full-sized avatar

Joel Pryde joelpryde

View GitHub Profile
@joelpryde
joelpryde / gist:5120327
Created March 8, 2013 22:12
GLSL Spiral
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#define PI 3.1415927
#define PI2 (PI*2.0)
@joelpryde
joelpryde / gist:5157577
Created March 13, 2013 23:47
GLSL noise
float snoise(vec3 uv, float res) // by trisomie21
{
const vec3 s = vec3(1e0, 1e2, 1e4);
uv *= res;
vec3 uv0 = floor(mod(uv, res))*s;
vec3 uv1 = floor(mod(uv+vec3(1.), res))*s;
vec3 f = fract(uv); f = f*f*(3.0-2.0*f);
@joelpryde
joelpryde / gist:5162828
Created March 14, 2013 16:30
GLSL Noise 2
float rand( float n )
{
return fract(sin(n*443.23)*43758.5453);
}
float hash( float n )
{
return fract(sin(n)*43758.5453123);
}
@joelpryde
joelpryde / gist:5162851
Created March 14, 2013 16:33
GLSL Noise 3
float mod289(float x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 mod289(vec4 x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
@joelpryde
joelpryde / gist:5162955
Created March 14, 2013 16:49
GLSL ambient wash
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#define N 12
@joelpryde
joelpryde / gist:5162967
Created March 14, 2013 16:50
glsl expando tris
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
vec2 center = vec2(0.5,0.5);
@joelpryde
joelpryde / gist:5162982
Created March 14, 2013 16:52
GLSL Zooming tris
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform float triHeight;
uniform float triSize;
@joelpryde
joelpryde / gist:5224151
Created March 22, 2013 19:42
GLSL clouds
/**
* @title Cloud Demo
* @version v0.3
* @author Mark Sleith
* @website www.cngames.co.uk/portfolio
* @date 15/08/2012
*
* @note Noise and fBm from iq's latest live coding video, "a simple eye ball".
*
* @todo Add varying cloud density, cloud illumination.
@joelpryde
joelpryde / flames.glsl
Created October 16, 2013 16:22
glsl good flames (screen space)
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
vec3 iResolution = vec3(resolution.x,resolution.y,100.);
vec4 iMouse = vec4(mouse.x,mouse.y,5.,5.);
@joelpryde
joelpryde / Quicktime.cpp
Created November 13, 2013 22:27
Changes to allow Cinder to do multi-channel QT audio
+void MovieBase::setAudioDevice(const std::string& audioDeviceName, float audioBalance)
+{
+ // create a QT Audio Context and set it on a Movie
+ ::QTAudioContextRef audioContext;
+ ::CFStringRef deviceId = ::CFStringCreateWithCString( kCFAllocatorDefault, audioDeviceName.c_str(), kCFStringEncodingUTF8 );
+ OSStatus status = ::QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, deviceId, NULL, &audioContext);
+ if (status)
+ throw QuickTimePathInvalidExc();
+