Overhead of openframeworks when using it opengl style

For a project, I tried rendering 50,000 boxes using ofDrawBox() and it was pretty slow.

To speed it up, I tried generating vertices myself and using glDrawArrays on a buffer, and I was able to render about 50,000 boxes with a good FPS (it can render about 200,000 before it slows down).

I want to use openframeworks because I don’t know how to implement something like ofEasyCam in vanilla openGL, but I was just curious:

If I tried using vanilla openGL to render cubes, would it be any faster than my current setup of glDrawArrays in the context of openframeworks? I.e. does openframeworks have a performance overhead that would slow down the performance of rendering via opengl?

Could ofEasyCam hurt performance, and should I be manually calculating a model-view matrix?


I’m not sure how you are using the boxes, but have you looked at the vboMeshDrawInstancedExample? I just tried it and could draw 500,000 boxes at around 60 fps.

In general, what is slow is sending data to the graphics card (cpu->gpu) – so in your first case, you are sending all the data for each box – this might not seem like a lot of data, but a ofDrawBox may contain vertex data, normal data, texture data, so it does add up and in general it’s the send of the data that’s usually slow.

glDrawArrays is faster – it’s faster when you batch data – but I think a VBOs that is drawn via an instanced way and modified via shaders will be alot faster.

if helpful this is a good intro to OpenGL


I don’t think there is much overhead in OF it’s more about understanding what is the most efficient way to get data to the graphics card…


Hey also check out the gpuParticleSystemExample. It uses textures (ofFbo) for the position and velocity data of particles, along with a geometry shader to create some vertices for rendering a texture for each particle. Some of the ideas in this example might pair really well with the vboMeshDrawInstancedExample that zach recommended.