Skip to content

Instantly share code, notes, and snippets.

#include "TwitterStream.h"
#include <sstream>
#include <iostream>
#define CHECK_CURL_ERROR(result) if((result) != CURLE_OK) { printf("Curl error: %s.\n", curl_easy_strerror((result))); return false; }
#define CHECK_CURLM_ERROR(result) if((result) != CURLM_OK) { printf("Curl multi error: %s.\n", curl_multi_strerror((result))); return false; }
using std::stringstream;
namespace roxlu {
@roxlu
roxlu / KeepThaAppRunning.scpt
Created January 24, 2012 23:11
Applescript which makes sure an application keeps running, with options to activate/hide the app.
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
on hideDock()
tell application "System Events"
keystroke "d" using [command down, option down]
end tell
end hideDock
@roxlu
roxlu / some_vertex_types.c
Created January 28, 2012 19:18
Vertex Types, Position, Texture, Normal, Binormal, Tangent
/*
struct VertexP : public Vertex { };
struct VertexPT : public Vertex { };
struct VertexPN : public Vertex { };
struct VertexPNC : public Vertex { };
struct VertexPTN : public Vertex { };
struct VertexPTNC : public Vertex { };
struct VertexPTNT : public Vertex { // with tangent. };
struct VertexPTNTB : public Vertex { // can be used for normal mapping
@roxlu
roxlu / VBOs.cpp
Created February 4, 2012 11:54
Shaders, vbo, fbo and vao
#include "Cards.h"
Cards::Cards(rb::World& w)
:world(w)
{
}
Cards::~Cards() {
}
void Cards::create() {
@roxlu
roxlu / Cards.cpp
Created February 4, 2012 18:24
Light rays
#include "Cards.h"
Cards::Cards(rb::World& w)
:world(w)
{
}
Cards::~Cards() {
}
void Cards::create() {
@roxlu
roxlu / Cards.cpp
Created February 4, 2012 21:10
Light rays
#include "Cards.h"
Cards::Cards(rb::World& w)
:world(w)
{
}
Cards::~Cards() {
}
void Cards::create() {
@roxlu
roxlu / testApp.cpp
Created February 4, 2012 22:57
Light Rays 0.0 - most basic code: only a quad
#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 4, 2012 23:11
Light Rays 0.1 - create VBO
// create VBO
VertexP* vertex_data = plane_data.getVertexP();
glGenBuffers(1, &plane_vbo); eglGetError();
glBindBuffer(GL_ARRAY_BUFFER, plane_vbo); eglGetError();
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexP) * plane_data.size(), vertex_data, GL_STATIC_DRAW); eglGetError();
@roxlu
roxlu / ray.c
Created February 5, 2012 10:42
Light Rays 0.2 - basic shaders
uniform mat4 projection_matrix;
uniform mat4 view_matrix;
attribute vec4 pos;
void main() {
gl_Position = projection_matrix * view_matrix * pos;
}
@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);
}