Using T&L

Hi,

I have an orrery simulation (solar system) that currently draws orbits as a GL_LINE_LOOP calculating the position of the points using standard trig functions and putting the points into an array which it then renders in a simple loop.

I want to take advantage of T&L but I’m not sure if this is exactly where it is used. To get to the center of the body’s orbit I use glTranslatef,Rotatef etc and I know that all of these are T&L accelerated but I would like to know if there’s an accelerated way of calculating the orbital path’s points. And for a relatively low vertex count object like this path; is it worth using compiled vertex arrays??

Stephen

How often do you recalculate the orbit?
If it’s a one time init, put the data into a display list and the driver will care for the most optimal way to get it on screen.
For for dynamic environments glDrawArrays() or glDrawElements() with a vertex3f array will do the job.

Cheers… :smiley:

As the model is centred around the sun the orbits of the planets are fixed but the moons of the planets and any probes, asteroids etc are dynamic.

I’ll try using the suggested functions though, thanks

Stephen

Wouldn’t the orbits of the moons be fixed with regard to the position of the planet? Simply using the same rotation/translation you use before drawing the planet could be used for drawing the orbit as well.

Yep.

I thought of that just after I’d put the reply post on the board. I’ll just whack it into a display list and re-render the same orbit scaled, translated and rotated after using one of the vertex-array type functions. Cheers anyway

Stephen