Skip to content

Instantly share code, notes, and snippets.

View ofZach's full-sized avatar

ofZach

View GitHub Profile
@ofZach
ofZach / gist:e602efb4fbd43858aa01aff6d015ef32
Last active September 15, 2020 15:22
how to make an openframeworks dylib
// ofApp.h :
#pragma once
#include "ofMain.h"
class line {
#include <videocapture/Capture.h>
using namespace ca;
class videoCaptureThreaded : public ofThread{
public:
static void fcallback(PixelBuffer& buffer){
@ofZach
ofZach / gist:73cd2cbb0e7757ee9df980c714712b4f
Created March 30, 2016 05:22
framerate independent smoothing example
ofPoint pt;
ofPoint smoothPt;
//--------------------------------------------------------------
void ofApp::setup(){
}
//--------------------------------------------------------------
void ofApp::update(){
@ofZach
ofZach / gist:26f7e65fcc8018db1f4c
Created March 5, 2016 19:04
paperjs examples from SFPC workshop
//---------------------------------------------------------------------- paper script -> javascript
// Define a point to start with
var point1 = new Point(10, 20);
debugger;
// Create a second point that is 4 times the first one.
// This is the same as creating a new point with x and y
// of point1 multiplied by 4:
var point2 = point1 * 4;
@ofZach
ofZach / gist:5c122f3ad33b47cd068a
Created December 1, 2014 23:03
trying to figure out setupOffAxisViewPortal
// make a sphere
ofSpherePrimitive sph;
sph.set(100, 10);
ofMesh s = sph.getMesh();
// grab the current camera
// this is to figure out where a camera "should" be, ie, for this overall picture where is the camera.
ofCamera mainCam;
mainCam.setupPerspective();
@ofZach
ofZach / gist:787439f86753b7c6a8c6
Created November 26, 2014 05:09
singleton template
#include <stddef.h> // defines NULL
template <class T>
class Singleton{
public:
static T* Instance() {
if(!m_pInstance) m_pInstance = new T;
assert(m_pInstance != NULL);
return m_pInstance;
}
protected:
@ofZach
ofZach / gist:f64f27f03cd0e57b4434
Created October 3, 2014 18:35
supercollider examples
// some small examples from in-class
f = { 1 + 1 + 1};
f.value;
a = {SinOsc.ar(440)}.play
a.free
for hiro
//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(255,0,127);
ofBeginShape();
@ofZach
ofZach / gist:9905458
Created April 1, 2014 00:37
rename testApp to ofApp
# rename files:
find . -type f -iname "testApp.h" -exec rename 's/testApp/ofApp/' {} \;
find . -type f -iname "testApp.cpp" -exec rename 's/testApp/ofApp/' {} \;
#find and replace
find . -type f -iname "ofApp.h" -exec sed -i "" 's/testApp/ofApp/g' {} \;
find . -type f -iname "ofApp.cpp" -exec sed -i "" 's/testApp/ofApp/g' {} \;