Created
May 4, 2015 21:24
-
-
Save victor-shepardson/6127aeb8de4e4b7b023c to your computer and use it in GitHub Desktop.
simple texture feedback example (untested)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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