Skip to content

Instantly share code, notes, and snippets.

@MartinBspheroid
MartinBspheroid / gist:8782425
Created February 3, 2014 11:35
OF Hide console for VS2012
// in main.cpp
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
@MartinBspheroid
MartinBspheroid / gist:9742374
Last active August 29, 2015 13:57
Cinder-RuttEtra
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder\Capture.h"
#include "cinder\Surface.h"
#include "cinder/gl/Texture.h"
#include "cinder/MayaCamUI.h"
#include "cinder/Camera.h"
#include "cinder\Utilities.h"
#include "cinder/params/Params.h"
#include "cinder/ip/EdgeDetect.h"
@MartinBspheroid
MartinBspheroid / gist:9900219
Created March 31, 2014 19:25
FMOD waveforms in Cinder
void Player::getWaveformPreview(vector <Vec2f> &preview, unsigned int size){
if (size == 0)
{
return;
}
preview.clear();
peak = 0;
void *waveData;
void *pointer2;
@MartinBspheroid
MartinBspheroid / gist:9920572
Created April 1, 2014 18:52
Usefull C++ stuff
double PI = 4.0 * atan(1.0); // precise PI calculation
@MartinBspheroid
MartinBspheroid / BullDog
Last active August 29, 2015 14:27
minimal autoreloading in Cinder it's called BullDog, LOL!!!!
/// minimal autoreloading in cinder
/// it's called BullDog, LOL!!!!
struct wFile
{
time_t time;
fs::path path;
std::function<void()> callback;
wFile(time_t t, fs::path p, std::function<void()> c) {
time = t;
path = p;
@MartinBspheroid
MartinBspheroid / vectorArrayManager
Created October 14, 2013 09:00
Vector array for particle systems etc.
for(vector<bloomPop>::iterator it = bloomPool.begin(); it != bloomPool.end();){ // loop through vector with iterator
it->update(); // update all objects in vector
if(it->time < 0){ /// if condition matches...
it = bloomPool.erase(it); // ..go to hell..
}else{
++it; // ..or keep counting and continue!
}
}
@MartinBspheroid
MartinBspheroid / grainnoise.frag
Created November 18, 2013 19:02
GLSL noise one-liner
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
@MartinBspheroid
MartinBspheroid / vectorArrayManager2
Created January 25, 2014 13:25
Vector Array Manager 2 - C++11 compatible
auto i = std::begin(inv);
while (i != std::end(inv)) {
// do some stuff
if (blah)
i = inv.erase(i);
else
++i;
}
void OSC_TestApp::setupReciever(int portNum)
{
if (mReciever)
{
mReciever->close();
mReciever.release();
mReciever = make_unique<osc::ReceiverUdp>(portNum);
} else
{
import java.io.File;
long lastTime = 0;
File f;
String[] data;
void setup() {
f = new File("e:/test.txt");
}
void draw() {
background(0);