Skip to content

Instantly share code, notes, and snippets.

@victor-shepardson
Created May 4, 2015 21:24
Show Gist options
  • Save victor-shepardson/6127aeb8de4e4b7b023c to your computer and use it in GitHub Desktop.
Save victor-shepardson/6127aeb8de4e4b7b023c to your computer and use it in GitHub Desktop.
simple texture feedback example (untested)
//in your .h file if using one
ofShader shader;
ofFbo fbo;
int w, h;
//in .cpp file
void ofApp::setup(){
w = 640; h=480;
ofEnableDataPath();
ofSetWindowShape(w,h);
ofEnableArbTex();
shader.load(ofToDataPath("<name of your shader>"));
fbo.allocate(w,h,GL_RGBA);
}
void ofApp::draw(){
fbo.begin();
shader.begin();
shader.setUniformTexture("state", fbo.getTextureReference(), 0);
//execute the shader for each pixel in fbo
ofRect(0,0,fbo.getWidth(),fbo.getHeight());
shader.end();
fbo.end();
//draw to the screen
fbo.draw(0,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment