Skip to content

Instantly share code, notes, and snippets.

@mruegenberg
Created May 18, 2016 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mruegenberg/510f607560285b781808acb42f9cc56d to your computer and use it in GitHub Desktop.
Save mruegenberg/510f607560285b781808acb42f9cc56d to your computer and use it in GitHub Desktop.
Problem with oF multiwindow and textures
// in GuiApp.h:
// ofFbo fbo2;
void GuiApp::setup(){
parameters.setName("parameters");
parameters.add(radius.set("radius",50,1,100));
parameters.add(color.set("color",100,ofColor(0,0),255));
gui.setup(parameters);
ofBackground(0);
ofSetVerticalSync(false);
fbo2.allocate(100,100);
}
void GuiApp::update(){
fbo2.begin();
ofClear(0);
ofFill();
ofSetColor(255,0,0);
ofDrawRectangle(0,0,100,100);
fbo2.end();
}
void GuiApp::draw(){
gui.draw();
fbo.draw(0,0);
}
// in ofApp.h:
// ofFbo fbo;
void ofApp::setup(){
ofBackground(255);
ofSetCircleResolution(200);
fbo.allocate(100,100);
}
//--------------------------------------------------------------
void ofApp::update(){
fbo.begin();
ofClear(0);
ofFill();
ofSetColor(255,0,0);
ofDrawRectangle(0,0,100,100);
fbo.end();
ofSetColor(255);
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(gui->color);
ofDrawCircle(ofGetWidth()*0.5,ofGetWidth()*0.5,gui->radius);
ofSetColor(0);
ofDrawBitmapString(ofGetFrameRate(),20,20);
fbo.draw(0,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment