Skip to content

Instantly share code, notes, and snippets.

// Records a local webcam feed and converts the recording to SWF.
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.media.Camera;
import flash.media.Video;
@jvcleave
jvcleave / gist:1558681
Created January 4, 2012 05:46
populate ofxSimpleGuiToo ComboBox with files
int fileID = 0;
vector<string> fileNames;
string fileExtension = "pex";
//
ofDirectory dir = ofToDataPath("", true);
dir.listDir();
vector<ofFile> files = dir.getFiles();
for(int i=0; i<files.size(); i++)
@kylemcdonald
kylemcdonald / ofxGlobalUtils.h
Created June 22, 2012 21:24
openFrameworks utilities for working with the mouse and screen even when an app does not have focus
#pragma once
#include "ofGraphics.h"
#include "ofImage.h"
class ofGlobalListener {
public:
ofGlobalListener();
virtual void globalMouseDown(float x, float y) = 0;
};
@roxlu
roxlu / Binnin2D.h
Created June 26, 2012 22:41
Simple templated 2D particle binning
#ifndef ROXLU_BINNING_2DH
#define ROXLU_BINNING_2DH
#include <math.h>
#include <vector>
using std::vector;
/*
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 8, 2024 03:13
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@roxlu
roxlu / PointCloudCompile.sh
Created July 8, 2012 10:40
Pointcloud PCL, compile script
#!/bin/sh
# PCL version 1.5.1
# Boost 1.49
# Eigen 6e7488e20373
# Flann 1.7.1
# QHull 2012.1
# VTK 5.10.0
d=${PWD}
bd=${PWD}/build
@roxlu
roxlu / LightRays.cpp
Created July 16, 2012 19:04
Light Rays
#include "LightRays.h"
#include <roxlu/opengl/Error.h>
LightRays::LightRays()
:w(0)
,h(0)
,tex(0)
,fbo(0)
,depth_buffer(0)
,frag_shader(0)
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
// this way you can include your images in the copy phase of the project and don't have to rely on a data/ folder for distribution
#ifdef TARGET_OSX
ofDisableDataPath();
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX);
CFRelease(resourcesURL);
@mazbox
mazbox / gist:3313248
Created August 10, 2012 10:26
unrolled normalized penner equations
#ifndef PI
# define PI 3.14159265358979
#endif
inline float easeInBack(float t) {
float s = 1.70158f;
return t*t*((s+1)*t - s);
}
@roxlu
roxlu / RainbowArc.cpp
Created September 15, 2012 12:33
Generating vertices for textured arcs
#include "RainbowArc.h"
RainbowArc::RainbowArc(VerticesPT& vertices)
:radius(100)
,width(5)
,fg_start_dx(0)
,fg_num_vertices(0)
,bg_start_dx(0)
,bg_num_vertices(0)
,vertices(vertices)