void TextureBloomer::update(ofBaseDraws &drawable, const int passes, const float radiuses[]){ fbos.current().begin(); ofClear(0, 0, 0, 0); drawable.draw(0,0); fbos.current().end(); for(int pass = 0; pass < passes; pass++){ float radius = radiuses[pass]; fbos.inc(); shader.update(radius, fbos.prev()); fbos.current().begin(); shader.draw(0,0); fbos.current().end(); } fbos.inc(); glEnable(GL_BLEND); glBlendFunc(blendSFactor, blendDFactor); fbos.current().begin(); ofClear(0, 0, 0, 0); fbos.prev().draw(0,0); drawable.draw(0,0); fbos.current().end(); glDisable(GL_BLEND); }
//--------------------------------------------------------------------- ofxSimpleGuiQuadWarp::ofxSimpleGuiQuadWarp(string name, ofBaseDraws &baseDraw, ofPoint *pts) : ofxSimpleGuiControl(name) { this->baseDraw = &baseDraw; setPos(0, 0); setSize(baseDraw.getWidth(), baseDraw.getHeight()); curPoint = NULL; this->pts = pts; controlType = "QuadWarp"; setup(); }
//--------------------------------------------------------------------- ofxSimpleGuiQuadWarp::ofxSimpleGuiQuadWarp(string name, ofBaseDraws &baseDraw, ofPoint *pts) : ofxSimpleGuiControl(name) { this->baseDraw = &baseDraw; setPosition(0, 0); setSize(baseDraw.getWidth(), baseDraw.getHeight()); curPoint = NULL; this->pts = pts; for(int i=0; i<4; i++) pts[i].z = i; // z axis stores the index controlType = "QuadWarp"; setup(); }
//TODO, try to get this on ofxFX intead, can't see the point of the texture alpha being set to one! // A simplified way of filling the insides texture void ExtendedFXObject::setTexture(ofBaseDraws& base, int _texNum){ if ((_texNum < nTextures) && ( _texNum >= 0)){ textures[_texNum].begin(); ofClear(0,0); ofSetColor(255); base.draw(0,0, width, height); textures[_texNum].end(); } };
void BlurShader::update(float radius, ofBaseDraws &drawable){ ping.begin(); hShader.begin(); hShader.setUniform1f("radius", radius); drawable.draw(0,0); hShader.end(); ping.end(); pong.begin(); vShader.begin(); vShader.setUniform1f("radius", radius); ping.draw(0,0); vShader.end(); pong.end(); }