Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libs/openFrameworks/gl/ofFbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ ofFbo::ofFbo(const ofFbo & mom){
}
}

//--------------------------------------------------------------
void ofFbo::operator+=(const ofFbo & fbo){
if (fbo.isAllocated()) {
this->begin();
fbo.draw(0,0);
this->end();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like it should be something like:

	//if we aren't allocated lets allocate to be the same as the input
	if (!this->isAllocated() && fbo.isAllocated()) {
 		this->allocate(fbo.settings); 
 	}
	if (fbo.isAllocated()) {
 		this->begin();
 		fbo.draw(0,0);
 		this->end();
 	}else{
 		ofLogWarning("ofFbo::operator+=") << " input fbo is not allocated, skipping += ";
 	}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimitre what do you think about the suggestion above?👆

This way it basically copies the fbo being += if the main fbo isn't allocated

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to add a check that if the fbo isn't allocated you can an error/warning
or you could have if it is not allocated it gets allocated to match first?

//--------------------------------------------------------------
ofFbo & ofFbo::operator=(const ofFbo & mom){
if(&mom==this) return *this;
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/gl/ofFbo.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture {
ofFbo();
ofFbo(const ofFbo & mom);
ofFbo & operator=(const ofFbo & fbo);
void operator+=(const ofFbo & fbo);
ofFbo(ofFbo && mom);
ofFbo & operator=(ofFbo && fbo);
virtual ~ofFbo();
Expand Down