Hi guys, lets say I have an electronics board .bmp showing up in my OpenGL application which has 2 LEDs. I want to draw two states for each LED, on and off and they need to be independent of each other. How is such independence possible? Please note, the method should be scalable to a larger number of LEDs.
The first solution is to have a state struct or something of the like and then every time one of the LEDs changes, I redraw the whole scene in accordance with the new state i.e. I have a background image which never changes, but say both LEDs were off and now one comes on, then the new state means we redraw the background plus that lit up LED from a list. If the second LED comes on, we redraw the background, the lit LED plus this new one. If one comes off, we redraw the background and now superimpose just one LED once again.
The other solution is to have a background image and then have two state images for each LED, ON and OFF and every time a state change occurs, simply redraw that one LED.
Are there other more elegant solutions to my problem? Which of these methods do you think is best?
Bookmarks