They work fine as they are but I’d like to take them out of setup to keep my main code as clean as possible.

I’ve done this as a pair of functions in their own cpp file and also as a struct, I’m just a bit worried that my lack of experience is going to bite me if I’m using a pattern that’s really messy as both these solutions to the problem have four extra vectors. I expect it doesn’t matter as they’re all small in this instance but when I’m working with more data this sort of thing will be a problem won’t it?

Thanks that’s really helpful advice. At the moment I’m just using them to draw a bunch of crosses and have random squares flash on the screen. The vectors won’t grow (they’re just to have all the positions to hand for other uses).

Plan is to have around twenty random squares fire at once and fade over time triggered by a keypress. Once that’s working swap the keypress trigger for midi and add spout so I can use the oF sketch as a mask in my VJing software that reacts to my bandmate’s midi drum patterns.

Your proposed structure seems fine. For my taste a function of that few calls would be a little overkill to place in a struct. I would probably just make a function within ofApp and call it from Setup & windowResized etc.

However, if you are happy with your struct route it is fine, I guess the only add I would suggest is if this is going to be expanded on later, maybe consider making it a Class rather than a Struct? Sometimes a class’s extra features end up being handy down the road.

Thank you, it’s all baby steps for me at the moment but I’m enjoying the challenge. Picking when something should be a function/class/struct I expect I’ll just get better at over time.

The window isn’t every going to be resized (while the program is running and the code is only going to be run once so I expect all the faffing around with it is a bit pointless and it really does just belong in setup().

Was quite pleased I managed to work out how to make sure if I need the program to run in a different window size or shape further down the line it’ll still work regardless of what dimensions are set in ofSetupOpenGL()