I'm trying to build a 3d object out of lots, 200 - 2500, of boxes. I'm doing this by :
//parentNode to add boxes to
CC3Node *parentNode = [ImageHandler make3DNodeFromImage:image];
//single generic box to copy
CC3BoundingBox bb;
bb.minimum=cc3v(-0.5,-0.5,1);
bb.maximum=cc3v(0.5,0.5,0.0);
CC3BoxNode *genericBox = [CC3BoxNode node];
[genericBox populateAsSolidBox:bb];
//loop over array of data adding boxes as i go
for(x to y){
CC3BoxNode *box=[genericBox copyAutoreleased];
// ... set color and location ...
[parentNode addChild:box];
}
[world addChild:parentNode];
[world createGLBuffers];
[world releaseRedundantData];
This works and displays exactly as i wanted it to ... but it's extremely slow to animate. With 350 boxes i get about 16FPS and for the app i'm building i want to have 5k+ boxes. Using CC3PerformanceStatistics I'm seeing that each box added also adds a GL call which I'm assuming is the issue. How can i optimize this creation process to get higher FPS?
I did try using only CC3PlaneNode nodes to draw the visible faces but this was actually worse (far fewer faces but many more GL calls).
p.s. Bill, thank you - cocos3d is already awesome.