How to move a object in Parabolic shape in OpenGL

Hi Everyone,

I have started learning OpenGL since 2 months. I am making one Basketball game where my aim is once user drag the ball and leave then it need to reach in basket or miss, depending upon parabolic equestion. So I am trying to move the object in Parabolic shape,I could draw the parabola but could not move the object so can anybody suggest how to move the object in parabolic shape.

Thanks
Girish

have a look at glTranslate - this is the basic function you need to move an object

Thanks For the reply…I am already glTranslate to move an object in x and y direction. But once I put the for loop to move an object in paraolic shape then sometimes window goes blank or geting unpridictable behaviour. Here is my function which draws sphares in parabolic Sphere but it does not move in prabolic shape. Can you please help me in this…

void DrawParabola()
// The Drawing Routine
{
double x,y;
glColor3f(1.0, 1.0, 1.0);
for (tranx = -2; tranx <= 8; tranx += .002)
{
glPushMatrix();
trany = 18* tranx -9* tranx * tranx;
glLoadIdentity();
tranx +=0.1Speedfact;
trany +=0.1
Speedfact;
glTranslatef(tranx*3,trany,tranz);
glutWireSphere(0.6, 20, 16);
glPopMatrix();
Sleep(50);
glutPostRedisplay();
}

}

Thanks For the reply…I am already using glTranslate to move an object in x and y direction. But once I put the for loop to move an object in parabolic shape then sometimes window goes blank or geting unpridictable behaviour. Here is my function which draws sphares in parabolic shape but it does not move in prabolic shape. Can you please help me in this…

void DrawParabola()
// The Drawing Routine
{
double x,y;
glColor3f(1.0, 1.0, 1.0);
for (tranx = -2; tranx <= 8; tranx += .002)
{
glPushMatrix();
trany = 18* tranx -9* tranx * tranx;
glLoadIdentity();
tranx +=0.1Speedfact;
trany +=0.1
Speedfact;
glTranslatef(tranx*3,trany,tranz);
glutWireSphere(0.6, 20, 16);
glPopMatrix();
Sleep(50);
glutPostRedisplay();
}

}

The code you have included looks ok but why do you change your loop control with

tranx +=0.1*Speedfact;

You may simply be calculating an x,y that is outside the view frustrum