Skip to content

Instantly share code, notes, and snippets.

@mazbox
Created July 17, 2012 14:37
Show Gist options
  • Save mazbox/3129784 to your computer and use it in GitHub Desktop.
Save mazbox/3129784 to your computer and use it in GitHub Desktop.
void tricks::gl::effects::Bloom::end() {
output.end();
out1.begin();
ofClear(0, 0, 0, 255);
// convolution 1
shader.begin();
shader.setUniformTexture("tDiffuse", output.getTextureReference(0), 0);
shader.setUniform2f("uImageIncrement", blurX.x*ofGetWidth(), blurX.y*ofGetHeight());
// shader.setUniform1fv("cKernel", values);
ofSetHexColor(0xFFFFFF);
output.draw(0, 0);
shader.end();
out1.end();
out2.begin();
ofClear(0, 0, 0, 255);
// convolution 2
shader.begin();
shader.setUniformTexture("tDiffuse", output.getTextureReference(0), 0);
shader.setUniform2f("uImageIncrement", blurY.x*ofGetWidth(), blurY.y*ofGetHeight());
// shader.setUniform1fv("cKernel", values);
ofSetHexColor(0xFFFFFF);
out1.draw(0, 0);
shader.end();
out2.end();
if(drawToFbo) {
out1.begin();
ofClear(0, 0, 0, 0);
}
ofEnableAlphaBlending();
ofEnableBlendMode(OF_BLENDMODE_ADD);
ofSetHexColor(0xFFFFFF);
//out1.draw(0, 0);
//out1.draw(0, 0);
glColor4f(1, 1, 1, 0.5);
out2.draw(0, 0);
//// draw over
ofSetHexColor(0xFFFFFF);
output.draw(0, 0);
if(drawToFbo) {
out1.end();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment