I know this has to be so easy but I’m just stuck. I’d be so thankful for any bit of help. The project is drawing a number of circles on screen based on the input from gui. That’s working fine, but I’d like each circle to have a different random color. I know, or thought I knew, how to generate random colors - but the circles won’t stay on that color! They keep cycling through all of them. I tried getting it to work with fbo but that didn’t seem right. What am I missing??? I’ve put my code below:
I almost got it! Moving the color loop to ::update solved the issue, I think it’s because setup only runs once? I’m still not sure why I can’t use more than one parameter for push_back though. Right now the circles are only black, white, or some shade of grey.
also, this is cheap hack, but sometimes I use ofSeedRandom(0) at the top of draw() which means you always get the same random results. It can be problematic if you need to use ofRandom() for anything else but I find it helpful if I just need to get a bunch of non changing random colors on the screen.
(random is not really random, and setting the seed to the same amount means each time you call ofRandom you get the same values in the same order, ie, the 100th time you call it will always give the same value the 100th time).
yeah it’s really useful, it’s also faster than push_back since it creates the object directly in the vector memory and allows to put objects that can’t be copied in a vector