how could i change the color in an animation, in my book, so far it's only shown hot to make the object move. I tried making an array:

Code:
float clvl[3]={0.0,0.0,0.0};
and putting it in with the drawing color:

Code:
glColor3f(clvl[0],clvl[1],clvl[2]);
and then made a statement that cycles through the different variables and changes them accordingly:

Code:
int pos=rand()%3;
if(clvl[pos]==1.0)
{
     clvl[pos]=0.0;
}
else
{
     clvl[pos]=clvl[pos]+.1;
}
The problem is, is that I don't know where to put this statement. I'm not using system specific code, so it should look like it fits in with a console application.