too many polygons?

hey all,

longtime listener, first time poster. thanks to everyone who’s contributed to OF in one way or another, the online docs have already been super helpful.

so: i’m working on a project that involves pushing as many polygons as possible (currently about 1000) to the iPad. it’s a static field of polygons, each of which constitutes one cell of a voronoi diagram. perhaps predictably, it’s pretty slow to drag the field around. but i’m not sure if that’s because my methods aren’t as efficient as they can be, or because i’m running up against a native limitation of the iPad (first-gen, fwiw).

my rendering code looks something like this:

    for (int i = 0; i < myMap.count; i++) {  
        tempSite = &myMap.mapSites[i];  
        ofTranslate(ofGetWidth()/2 + tX, ofGetHeight()/2 + tY, 0);  
        for (int j = 0; j < myMap.mapSites[i].numPoints; j++) {  
            ofVertex(tempSite->sitePoints[j].coord.x, tempSite->sitePoints[j].coord.y);  

pretty normal, i think, but perhaps expensive given that each of the 1000 polygons has 5-6 vertices. it runs like a dream on the iOS simulator, but that’s running on a newish MBP, so.

if this isn’t something i can make more efficient, any idea what the workable limit is? all thoughts appreciated.

I dont remember how ofBegin/EndShape() internals work, but try using ofVboMesh instead of ofBeginShape, I use ofVbo and my framerate went up 15fps in avg.

For a brief intro to ofVbo checkout the OpenGL section from slide 13 here

nice - thanks for the rec! going to check that out.