I want to draw billboarding bitmap trees. Their background is
transparent, so I need to sort them to erase the visual artifacts
that would appear otherwise. To draw them from front to back, I
need to know their distance from the viewer. If I have 100 trees,
I need 100 square roots each frame. Not good. This is my first
After I calculated the distances from the viewer, I want to sort them
so that they are drawn in correct order. I want to use the qsort()
function for this. This is my second problem. I can't get qsort() to
accept my callback function:
int CTreeCollection::Compare(const void *arg1, const void *arg2)
(My compiler is VC++ 6.0)
I always get the error "int (const void *,const void *)" can't be
converted in int "(__cdecl *)(const void *,const void *)". I have no
idea how to solve this. How should my callback function look ? How shold I
pass the callback function to qsort() ?
Can anyone help me to speed up / avoid those square roots every frame ?
Does anyone know how to use qsort() ?
Someone out there with a better idea to do all this stuf ?