Results 1 to 2 of 2

Thread: Random Angle

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2011
    Posts
    2

    Random Angle

    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.
    Code :
    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();
    }

  2. #2
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,161

    Re: Random Angle

    ...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.

Similar Threads

  1. Angle in Degree to Euler Angle
    By bobGL in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 11-07-2007, 07:04 AM
  2. Help me to find the right angle
    By rogerdv in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-11-2003, 05:13 AM
  3. Angle between two vectors [0..2PI]
    By Erakis in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-15-2002, 10:38 AM
  4. Getting the angle of FOV
    By nckchan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-01-2001, 09:42 AM
  5. angle between 2 points?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-05-2000, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean