question about speed of openframeworks

Hello im very new with openframeworks. i been using processing , im interesting in developing systems of interacting agents, in processing i feel very limited in the number of agents i can use before my computer became slow. Is there any way to know how much faster does a same application made in processing runs on openframeworks?
Ive made some test just with bouncing spheres in a macosx leopard with 2.4, in processing i can have until 200 spheres before my computer became slow. I ve tried the same in openframeworks and i discovered it is faster but not so much. I can run until 400 spheres until my computer became slow. I sincerely expected much powerful results on openframeworks. what about if i need to make 1000 or 2000 objects in openframeworks that runs smooth? is that possible? any hint?

thanks in advance


sometimes it’s much about how you draw, and the techniques that you use to optimize.

I don’t think you can compare speed in this way. n^2 problems (ie particle particle interaciton) and even n log n problems are not linear :slight_smile: – getting 400 objects to interact with each other is not twice faster then getting 200. For 1000 - 2000 you will definitely need some optimization, like binning. for > 2000, like 10,000 etc, you’ll need some really smart stuff.

I have examples of particles interacting with each other (approx 2000 and 8000) here:

it’s 2d, but could be extended for 3d without problem…

take care!

ps: You didn’t post your code that you are testing with, so I’m not sure how are you are drawing, but our circle is by default made up of 22 triangles, use ofSetCircleResolution(…) to make it smaller, like ofSetCircleresolution(10) and you will have much fater draws (or use ofRect()).

Hi Zach
i was just going through the examples you posted, thats really amazing!
but i dont quite get it how it works… i tried googling about the subject but i cant seem to find anything on the subject… do you know a place where i could search more (links, a book)?


hi zach thanks for the reply and examples, i was trying to compile the examples you posted but i had no luck. How are they supposed to run? im using openframeworks v 0.06 . Im putting the examples folders inside apps/examples/ but it doesnt work, any hint? it seems i dont have some files or maybe i have some of the files in other path : ive tried copying the folders in the right position but im still getting errors.
im getting 106 errors like this:
In file included from …/…/…/libs/openFrameworks/events/ofEvents.h…
…/…/…/libs/openFrameworks/events/ofEventUtils.h:5:28: error: Poco/FIFOEvent.h: No such file or directory
…/…/…/libs/openFrameworks/events/ofEventUtils.h:6:27: error: Poco/Delegate.h: No such file or directory

any hint?

other question what does the "…/…/…/ " means?

thanks in advance


ah - they are written for OF 0.05 (since the course was taught in the fall). just do the following:

a) duplicate the vector math example in the fat package and rename the folder.
b) copy the source code that you are trying to compile in, replacing the source code of the copied example
c) make sure that extra code (like particle.cpp / particle.h) is added to the project. on xcode you can drag and drop files and folders in.

that should be all that’s necessary to get that code to compile. there are a few examples that use both the vector math and the opencv addon, and there you should copy the allAddons example.

alternatively, you can download 0.05 FAT, and they will work right away, just to give yourself a feeling of the code examples and what you might want to bring over.

hope that helps!

ps: the …/…/…/ is the path to the libs folder (all apps are pointing relatively to the folder of libs). that way, you can have projects like:


and they will both work…

Hi Zach ive tried the examples in openframeworks v 0.05 and it works but just the first two examples, the third one “particlesVideo” doesnt work . When i compile i get succeeded and it opens the app but the app doesnt work and then i get this error :
GDB:Error: Xcode could not locate source file: cpu_capabilities.h(line: 246) Any idea of what is going on? im on macosx Leopard

many thanks

Zach is there any tutorial , link or book you recommend for understanding those techniques such as binning and sorting?


are those techniques just for c++ or can they be applied to languagues such as java/processing?