I’ve been messing around with the Tokamak physics engine. I place many solid cubes in a stack 10 across and as high as needed for the num of cubes I select.
Now, I want the cubes to be different colors.
Easily done. But they were, well, not random enough.
So, I commented out the lines and made the colors random.
k = ( (rand()*1.0)/RAND_MAX ) * 5; //k++; if(k == 1) SetColorGreen(); if(k == 2) SetColorBlue(); if(k == 3) SetColorRed(); if(k == 4) SetColorYellow(); //if(k == 4) //k=0; glCallList(cube_id);
Due to the framerate, the colors blink - change colors that is while playing.
Is there a way to assign a color to each cube randomly so that when the cubes are re-rendered, it remembers it’s color assignment?