Original Post
I am generating a tree using L-systems, so I have the vertex positions for trunk and branches in a list and leaf positions in another list. For leaves I am placing billboard QUADS with transparent textures, so I am sorting them in 'back-to-front' order before drawing them. There are like 300 leaf billboards for a single tree. All is good until I don't apply any rotations, the frame rate is like 50 for a single tree when it's rotated!! I am doing something like this: Please tell me what is wrong here, how can I improve the performance?
//draws trunk and branches here..opaque geometry
drawTree();
//updating the leaf positions according to the current modelview matrix
for(i=0;i<leaflist.size();i++)
{
sortedleaflist = leaflist;
temp = sortedleaflist;
temp.x = ModelViewMatrix*temp.x;
temp.y = ModelViewMatrix*temp.y;
temp.z = ModelViewMatrix*temp.z;
sortedleaflist = temp;
}
//sorting the list
std::sort(sortedleaflist.begin(),sortedleaflist.end(),myPredicateForSorting);
EnableBlending();
for(i=0;i<sortedleaflist.size();i++)
{
temp = sortedleaflist;
//For billboarding
LoadIdentity();
DrawQuadBillBoard(temp.x,temp.y,temp.z);
}
DisableBlending();