Is drawing with ofFbo more efficient than just drawing a single object?

Hi, I wonder how efficient it is to draw with ofFbo compared to common drawing.

I think it should be efficient if I grab many objects (i.e shapes, labels, images) all together and then draw just once.

But is there any benefit in efficiency, even compared to just drawing one single object?

For example, what if I grab and draw a circle(ofDrawCircle) with ofFbo in same size instead? what about label?(ofTruetypeFont) or an image?

I would like to know if there’s any extra benefit to draw an object through ofFbo than just drawing in a common way.

When you don’t explicitely use an ofFbo, it’s all being drawn onto a framebuffer anyways. So it is always faster to draw directly to the screen (again, it’s not the “screen”, but the default framebuffer). Provided that you end up calling ofFbo::draw of course : )

FBOs have other advantages, like combining renders with alpha values, or getting the depth buffer from a render pass. You can also use them to post-process each frame through a shader.


Thank you for the reply.

So, if I understood correctly, would you say calling ofFbo.draw is faster than single ofDrawCircle or ofTrueTypeFont.drawString? Provided that ofFbo is already set using begin() and end()?

If so, I’m planning to make my GUI objects to be drawn with ofFbo only and only re-write each GUI into the buffer whenever there’s an update in GUI’s property (i.e size, color…).

For example, if I create a button GUI, it will be drawn by ofFbo and only if I press the button so the color should be changed, it will be drawn with common object(ofCircle, ofRect) until re-writing the new one into the buffer gets done.

Could this be a good idea for getting the extra efficiency?

Okay so that’s like saving the circle and text assets as GUI elements. Yes that should work fine and should be faster than the ofDrawCircle and drawString methods as they generate meshes to be rendered. Using the fbos should be fine and fast.

Overall the efficiency gain will not be great, you’d be just fine rendering directly…You should measure it though and see if it’s worth it.


Thank you very much!!