Hi…Im working on a project that has to do with elliptical trajectories of satellites…
My satellite is moving well(well, it looks like it is), the only thing is, i’d like to draw the path its taking.
This is what I have right now:
int mod = (counter-1)%360;
x5[mod]=x-rp;
y5[mod]=y;
glPointSize(20);
for(int i=0; i<mod; i++)
{
glBegin(GL_POINTS);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(x5[i],y5[i], 0);
glEnd();
if (counter>360)
{
for(int k=359; k>(mod); k–)
{
glBegin(GL_POINTS);
glVertex3f(x5[k],y5[k], 0);
glEnd();
}
}
counter++;
Technically, what it’s doing is drawing all the points until counter, everytime the screen refreshes, then, weh glDRAW() starts over, it redraws them all, plus the newest coordinate found.
Once counter hits 360(which represents the degrees, all around the ellipse), the loop starts over redrawing first, second, third,etc…, but another loops starts and redraws from last up until where my other loop is at…
I dont know if you guys get what i mean, but it’s not all complicated. In short, after one full revolution, one loop draws clockwise, and another draws counter clockwise untill it meets the satellite.
The reason i do this is because my program lets the user change the “initial speed” So i’d like the user to see the difference in the trajectory.
My problem is, once the second loop starts, the animation slows down…ALOT… Pretty obviud why, since it’s drawing about 720 points in one shot…not too mention a textured square(satellite), and a sphere…
I’d like to know if there’s a more efficient way of creating showing the trajectory, as it is being traced…
(BTW, with only one loop, at the end of one revolution, the trajectory erases, and starts over)
Thanx Alot!