Display Sphere

  1. trying to generate 50 random sphere in random location.

  2. using random # to find coordinates and using glTranslatef() to move.

the problem is when i am trying to display the next sphere the previous sphere is disappaearing… is there anyway to retain the previous frame into the memory and when the next sphere is drawn update with the previous frame???

commands used:
glTranslatef(rand()%50, rand()%30, rand()%10)

glutSolidSphere(rand()%20, 50, 50)

i am using double buffering to accomplish the task.

pls help asap with this problem. to retain r to merge each sphere when trying to draw the next sphere.

thanx.

You should be drawing all the spheres every frame before you swap the buffers.

Simple code to draw 50 circles.

int i;

for(i=0; i < 50; i++) Draw Sphere 50 times
{
glPushMatrix();
glTranslatef(rand()%50, rand()%30, rand()%10)
glutSolidSphere(rand()%20, 50, 50)
glPopMatrix();
}

Originally posted by ajmrm:
[b]1. trying to generate 50 random sphere in random location.

  1. using random # to find coordinates and using glTranslatef() to move.

the problem is when i am trying to display the next sphere the previous sphere is disappaearing… is there anyway to retain the previous frame into the memory and when the next sphere is drawn update with the previous frame???

commands used:
glTranslatef(rand()%50, rand()%30, rand()%10)

glutSolidSphere(rand()%20, 50, 50)

i am using double buffering to accomplish the task.

pls help asap with this problem. to retain r to merge each sphere when trying to draw the next sphere.

thanx.[/b]