Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / frag_shader.c
Created February 5, 2012 11:31
Light Rays 0.3 - complete using shaders and VBO
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.4, 1.0);
}
@roxlu
roxlu / testApp.cpp
Created February 5, 2012 11:47
Light Rays 0.4 - using VAO
#include "testApp.h"
void testApp::setup(){
ofBackground(33);
ofSetVerticalSync(true);
take_screenshot = false ;
// create quad width size "s", centered
float s = 1;
float hs = s * 0.5;
@roxlu
roxlu / testapp.cpp
Created February 5, 2012 12:05
Light Rays 0.5 - drawing into FBO
#include "testApp.h"
void testApp::setup(){
ofBackground(33);
ofSetVerticalSync(true);
take_screenshot = false ;
// create quad width size "s", centered
float s = 1;
float hs = s * 0.5;
@roxlu
roxlu / frag_shader.c
Created February 5, 2012 12:43
Light Rays 0.6 - drawing into FBO + showing the "render to texture" result
uniform sampler2D texture;
uniform int mode;
varying vec2 tex_v;
void main() {
if(mode == 1) {
gl_FragColor = vec4(1.0, 0.0, 0.4, 1.0);
}
else if(mode == 2) {
gl_FragColor = vec4(1.0, 0.6, 0.0, 1.0);
@roxlu
roxlu / rays.c
Created February 5, 2012 12:49
Light Rays 0.6 - Fabien Sanglard's light ray shader
uniform float exposure;
uniform float decay;
uniform float density;
uniform float weight;
uniform vec2 lightPositionOnScreen;
uniform sampler2D firstPass;
const int NUM_SAMPLES = 100 ;
void main() {
vec2 deltaTextCoord = vec2( gl_TexCoord[0].st - lightPositionOnScreen.xy );
@roxlu
roxlu / testapp.cpp
Created February 5, 2012 14:05
Light Rays 0.7 - identity projection and view matrix to render full screen
// 2a: now that we've got the scene in a texture we're going to apply an
// effect on it. To apply an effect we need to draw it again now using the
// mode = 3.
//
// note that we use a trick here to draw the rendered scene onto a plane
// with a width and height of 2. (-1 to 1). which are the normalized
// device coordinates. Basically what we do here is drawing the captured
// scene (captured with fbo) onto a plane which is almost the same size
// of the window. I say almost because we use 1.9 here (instead of 2).
//
@roxlu
roxlu / slide.js
Created February 7, 2012 00:37
Sliding in DOM elements.
var dewars = null;
var Site = new Class({
initialize: function() {
this.initListUpdater();
}
,initListUpdater:function() {
var list = $('last');
var li = null;
@roxlu
roxlu / testApp.h
Created February 7, 2012 22:47
Supersimp water simulation
#pragma once
#include "ofMain.h"
#include "Roxlu.h"
struct point {
int i;
int j;
};
class testApp : public ofBaseApp{
@roxlu
roxlu / badwords.txt
Created February 8, 2012 13:39
Bad words
ahole
anus
ash0le
ash0les
asholes
ass
Ass Monkey
Assface
assh0le
assh0lez
@roxlu
roxlu / save_binary.cpp
Created February 9, 2012 22:34
Saving data into a binary file (no endianness check)
#include "TwitterSearchTermQueue.h"
namespace roxlu {
TwitterSearchTermQueue::TwitterSearchTermQueue()
:filepath()
{
}
TwitterSearchTermQueue::~TwitterSearchTermQueue() {