Skip to content

Instantly share code, notes, and snippets.

View vanderlin's full-sized avatar

Vanderlin vanderlin

View GitHub Profile
@vanderlin
vanderlin / gist:cb905bafc6e9aa5b84eca050e65d06b7
Created January 21, 2021 17:49
vector of ofxBox2d Circles
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
// first init box2d
box2d.init();
// set the gravity
box2d.setGravity(0, 10);
@vanderlin
vanderlin / gist:f12e891435f5c43da1d55400330741b7
Last active January 21, 2021 15:51
basic ofxBox2d circle
//--------------------------------------------------------------
void ofApp::setup() {
// first init box2d
box2d.init();
// set the gravity
box2d.setGravity(0, 10);
// create bounds x,y,w,h
@vanderlin
vanderlin / ofApp.cpp
Created August 5, 2019 18:19
Color Palette from image (OpenCV KMeans)
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
video.setDeviceID(0);
video.setup(320, 240);
}
//--------------------------------------------------------------
@vanderlin
vanderlin / main.cpp
Last active July 2, 2019 17:11
using a shader and texture OF+iOS
#include "ofApp.h"
int main() {
// here are the most commonly used iOS window settings.
//------------------------------------------------------
ofiOSWindowSettings settings;
settings.enableRetina = true; // enables retina resolution if the device supports it.
settings.enableDepth = false; // enables depth buffer for 3d drawing.
settings.enableAntiAliasing = false; // enables anti-aliasing which smooths out graphics on the screen.
@import url(./reset.css);
@import url(./fonts.css);
@import './colors.scss';
@import './typography.scss';
/* apply a natural box layout model to all elements, but allowing components to change */
html {
box-sizing: border-box;
user-select: none;
-webkit-tap-highlight-color: transparent;
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(246, 189, 208);
gui.setup();
gui.add(value.set("value", 2.5, 0.00001, 3));
gui.add(speed.set("speed", 0.045, 0.00001, 3));
{
"total_cars": 6,
"spots": {
"spot_13": {
"is_open": false,
"color": [
{
"r": 78,
"g": 78,
"b": 61,
#include "ofApp.h"
vector<ofVideoDevice> devices;
int deviceCount = 0;
ofVideoGrabber vidGrabber;
int camWidth;
int camHeight;
//--------------------------------------------------------------
void ofApp::setup() {
camWidth = 320;
@vanderlin
vanderlin / ofVideoGrabber change device
Created September 18, 2017 20:27
have to create a pointer object to change device.
#include "ofApp.h"
vector<ofVideoDevice> devices;
int deviceCount = 0;
ofVideoGrabber * vidGrabber = NULL;
int camWidth;
int camHeight;
//--------------------------------------------------------------
void ofApp::setup() {
camWidth = 320;
#include "ofApp.h"
// Note:
// You need ofxGui
// You can download the texture here: https://www.dropbox.com/s/15lw3lh87yp11za/tex-bigger.jpg?dl=1
ofPolyline resampled;
ofPolyline points;
ofParameter<float> resampleLength;
ofParameter<bool> bDrawWireframe;