Browse Source

Add possibility to disable FboSource::draw() when needed

master
Krisjanis Rijnieks 9 years ago
parent
commit
fb1621b773
  1. 10
      src/Sources/FboSource.cpp
  2. 4
      src/Sources/FboSource.h

10
src/Sources/FboSource.cpp

@ -8,6 +8,7 @@ FboSource::FboSource() : fbo(0){
loadable = false;
loaded = false;
type = SourceType::SOURCE_TYPE_FBO;
_disableDraw = false;
}
FboSource::~FboSource(){
@ -48,6 +49,11 @@ void FboSource::onAppDraw(ofEventArgs & args){
ofLogWarning("FboSource") << "FBO not allocated";
return;
}
if(_disableDraw){
return;
}
fbo->begin();
draw();
fbo->end();
@ -57,6 +63,10 @@ void FboSource::onAppExit(ofEventArgs & args){
exit();
}
void FboSource::setDisableDraw(bool b){
_disableDraw = b;
}
void FboSource::allocate(int width, int height){
clear();
fbo = new ofFbo();

4
src/Sources/FboSource.h

@ -30,6 +30,7 @@ class FboSource : public BaseSource {
void onAppUpdate(ofEventArgs & args);
void onAppDraw(ofEventArgs & args);
void onAppExit(ofEventArgs & args);
void setDisableDraw(bool b); // Use in cases with external ofFbo
protected:
ofFbo * fbo;
@ -38,7 +39,8 @@ class FboSource : public BaseSource {
// Some handy getters
int getWidth();
int getHeight();
bool _disableDraw;
};
} // namespace piMapper

Loading…
Cancel
Save