For good looking transparency effects, I know that I should enable depth buffering, draw all my solid polygons, and then draw my transparent polygons sorted from back to front.

My question is how do I sort them? Can I use an OpenGL function to calculate the distance from the eye point (0,0,0) to a translated/rotated point on my polygon in 3-space? Or do I need to calculate the distance myself? How? I know the formula for distance, but what’s the best way to account for the rotation and translation? I’ve looked in the OpenGL Bible and can’t find the answer.

What point is best to use for sorting? The nearest, farthest, or mid-point? Why?

If you know of a good tutorial for this, please post a link. I’ve been to NeHe’s but the actual sorting process was not described in enough detail for me to follow.

Thanks in advance for the help!