Skip to content

Instantly share code, notes, and snippets.

// vert
#version 150
out vec4 outColor; // this is the ultimate color for this vertex
out vec2 outtexcoord; // pass the texCoord if needed
out vec3 transformedNormal;
@joshuajnoble
joshuajnoble / gist:6221014
Created August 13, 2013 13:22
fixing error in ofXml.cpp
string ofXml::getAttribute(const string& path) const {
Poco::XML::Node *e;
if(element) {
if(path.find("[@") == string::npos) {
// we need to create a proper path
string attributePath = "[@" + path + "]";
e = element->getNodeByPath(attributePath);
@joshuajnoble
joshuajnoble / bgSubtractApp.cpp
Last active December 21, 2015 13:49
Using Background subtraction in Cinder
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "cinder/Capture.h"
#include "CinderOpenCV.h"
using namespace ci;
using namespace ci::app;
using namespace std;
@joshuajnoble
joshuajnoble / bgModelApp.cpp
Created August 23, 2013 04:43
Using BackgroundSubtractorMOG2 in Cinder
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/Capture.h"
#include "CinderOpenCV.h"
#include "cinder/gl/Texture.h"
using namespace ci;
using namespace ci::app;
using namespace std;
uniform sampler2D src_tex_unit0;
uniform vec4 globalColor = vec4(1.0);
in vec2 texCoordVarying;
in vec4 colorVarying;
out vec4 fragColor;
uniform vec3 lightCenter;
uniform float lightRadius;
@joshuajnoble
joshuajnoble / binding.gyp
Last active September 23, 2020 04:01
Install "node-gyp", compile with "node-gyp configure build", voila.
{
"targets": [
{
"target_name": "keypress",
"conditions": [
['OS == "mac"', {
'include_dirs': [
'System/Library/Frameworks/CoreFoundation.Framework/Headers',
'System/Library/Frameworks/Carbon.Framework/Headers',
],
@joshuajnoble
joshuajnoble / instancing.vert
Created December 25, 2013 20:13
mat for transforms for instancing - can't test on OSX so may not work :/
#version 150
in mat4 transformMatrix;
in vec4 position;
uniform mat4 modelViewProjectionMatrix;
void main()
{
mat4 mvp = modelViewProjectionMatrix * transformMatrix;
// declaration stays the same
ofTexture {
private:
ofTextureImpl *textureImpl; // raw ptr or ofPtr?
public:
// all the usual stuff here
};
@joshuajnoble
joshuajnoble / gpu_hog.cpp
Last active January 22, 2020 14:50
passing SVM to gpu::HOG
// might need to check
// http://stackoverflow.com/questions/15033363/obtaining-weights-in-cvsvm-the-svm-implementation-of-opencv/15070681#15070681
// for more info on how to get the svm from the CvSVM object to pass to HOG
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>
#include <stdexcept>
@joshuajnoble
joshuajnoble / IRremote_compiler
Created June 23, 2014 18:25
IR-Remote for ATTiny85 compile
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=attiny85 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Users/joshua.noble/code/arduino/hardware/attiny/variants/tiny8 -I/Users/joshua.noble/code/arduino/libraries/IRremote /var/folders/kg/66v_t1ps7ms7hn4llkd46n2m9wrvdb/T/build9164954935591061918.tmp/IRtinyTest.cpp -o /var/folders/kg/66v_t1ps7ms7hn4llkd46n2m9wrvdb/T/build9164954935591061918.tmp/IRtinyTest.cpp.o
In file included from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Stream.h:26,
from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:193,
from IRtinyTest.ino:12: