hey @npisanti, thanks for that suggestion to use ofxDotFrag.
I am building an “oled screen emulator” and It’s working nice to invert a selected text line on the screen.

I have an isolated class/addon for this that works fine on a clean ofApp. But when including into the main app I am building, I am getting in trouble with alpha transparency alphablending, drawings modes, arb texture or I don’t know… but the rectangle that I am inverting is just full filled black or not drawed.
I tried several combinations of enabling alpha blendings, disabling all other draws into draw() method, to used push/pop Style… without success. Maybe some of the other addons that I am using has some drawing/GL/alpha mode…)
Could be the way that I am cleaning / updating the zones in the fbo (I am really newbie with them) …
I tried too to use not alpha fbo but not worked neither…)
I put some code here to ask you or someone if there’s something strange:
//.h
ofFbo rgbaFbo; // the full lcd-screen rectangle
ofFbo fbo2; // the inverted line or pixels zone
ofx::dotfrag::InvertStrobe frag;
void ofxOled::setup()
{
rgbaFbo.allocate(128, 64, GL_RGBA);
rgbaFbo.begin();
ofClear(255,255,255, 0);//white
rgbaFbo.end();
fbo2.allocate(128, 9, GL_RGBA);
frag.allocate( fbo2 );
frag.active = true;
}
// add/draw just a text line into the lcd-screen fbo
// there are other lines that I don't want to erase
// that's the reason why I don't make a ofClear( ) after the begin()
void ofxOled::gPrintln(int x, int y, int color, string txt)
{
rgbaFbo.begin();
ofPushStyle();
ofNoFill();
ofSetLineWidth(0.5f);
ofSetColor(color);
font.drawString(txt, x, y);
ofPopStyle();
rgbaFbo.end();
}
// invert a rectangle zone when called
void ofxOled::gInvertArea(int x, int y, int w, int h)
{
// apply shader to invert area into a 2nd fbo
fbo2.allocate(w, h, GL_RGBA);
fbo2.begin();
// get the subsection we want to invert from the lcd-screen fbo
rgbaFbo.getTexture().drawSubsection(0, 0, w, h, x ,y, w, h);
fbo2.end();
// 1. apply ofxDotFrag inverter shader
frag.apply( fbo2 );
//-
// 2. draw inverted zone upon in front of lcd-screen fbo
rgbaFbo.begin(); // don't want to clear all, just add upfront
fbo2.draw( x, y );
rgbaFbo.end();
}
// main draw
void ofxOled::draw()
{
ofPushMatrix();
ofTranslate(pos);
// draw lcd-screen with the inverted rectangle included
rgbaFbo.draw(oLed_x, oLed_y);
// preview inverted rectangle line only, displaced 200px to the right
fbo2.draw( oLed_x + 200, oLed_y );
ofPopMatrix();
}