I am not sure how to go about setting up a method to determine a color value for each object that is unique. Obviously they need to be unique to determine which one you clicked on, but with only RGB 256 each channel just doing red++ for 256 values and moving to green++ is one way but how can I code it so it a rolling increment.
e.g.
start with red = 0, red++ when red hits 255 move to green, when green hits 255, blue is incremented to 255 then after that start with red = 1, green = 1, blue = 1 or other combos green = 1, blue = 1 red = 0?
Not sure I am making myself clear, but starting to think ray casting and AABB would just be easier in the long run?
THanks!
For unique colors, you can simply have the color be a 32bit number, and add one when you need a new one. To extract the color, take the bottom eight bits as red, the next lowest eight bits as green, then the eight bits above that as blue. If you want the exact scheme as you've posted, that will require some more logic, but this is the fastest way.