drawing my ui (openGL)
I'm creating a user interface for one of my programs in openGL, and I want to draw it as efficiently as possible. The ui consists of a few layers :
- screens : can be thought of as backgrounds in which you can draw anything you want. Are as big as the window.
- panels : floating panels in which anything can be drawn. Are not as big as the window, and can overlap.
- buttons : can be placed in panels (not in screens though).
Any of these layers (except screens) can be transparant, semi-transparent or not transparent.
I want to draw the Gui as efficient as possible (I don't want to redraw everything each frame). So if only a panel has to be redrawn, I don't want to redraw the whole screen too. If only one button has to be redrawn, I don't want to redraw the whole panel and screen. This is not easy though when the buttons and panels are semi-transparent. So does anyone have an idea how I can solve this problem ? It has to work on all graphics cards that support openGL (if possible).
Thanks in advance.
The UI isn't going to slow down your app much. You could use triangle strips (probably unnecessary, since the UI elements would only need quads anyway), and display lists.
I'm not sure how to get away with just redrawing a panel rather than the whole screen though.