PDA

View Full Version : Random Angle



l33tz
05-15-2011, 02:53 PM
Hello, I have some problem that i can't figure out.
Lets say I want to put 6 cubes in a circle, where the angle is random, from 0 to 360. It is working fine but after random 6 numbers it keeps going on and drawing new circle with new angles, how to set it just to draw the numbers once when program is started? Atm I have something like that.

srand ((int) time(NULL));
int tab[6];
for (int i=0; i<6; i++)
{
tab[i]=rand()%360+1;
glPushMatrix();
glRotatef(tab[i],0,1,0);
glTranslatef(0,0,1.5);
glScalef(0.2,0.2,0.2);
Cube();
glPopMatrix();
}

BionicBytes
05-16-2011, 12:35 AM
...er just call the function once.

This does suggest you are using someone else's framework and you don't know what you are doing with that.