1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
GLUT users wanting a GLUT user interface toolkit,
Tom Davis (an SGI founder) has contributed his micro-UI toolkit ported
to GLUT. With this user interface library, it should be possible to
write an OpenGL application with a very asthetically pleasing user
interface.
See the subdirectories:
lib/mui
test/mui
progs/mui
The micro-UI is "as is" and currently doesn't have any documentation
beyond the short description below written by Tom.
- Mark Kilgard
July 16, 1997
Here's some experimental code for a micro-ui (MUI).
The code that draws the widgets is taken from the old Showcase "libui",
and has been ported to OpenGL. The showcase code had routines to draw
the various widgets in many "states" -- selected, highlighted, inactive,
et cetera.
The philosophy behind MUI is to provide a ui library with multiple
levels of access. At the lowest level, if you just want to draw pretty
buttons and handle all the interaction yourself, it should provide
that. But if you'd like to make a list of the widgets and have the
code do locate-highlight as your mouse passes over the buttons and make
callbacks when buttons are pressed or sliders are slid, it should
provide that too.
You should also be able to work at intermediate levels. For example,
the Showcase libui has "radio buttons", where a bunch of them are linked
together, and if you press one, the previously pressed button is
released. But if you'd like to use these for a non-radio-like purpose
becasue you like the way they look, you can do so, but you'll have to
manually control which ones are activated.
There's no layout tool (although I have some ideas on that topic --
I'll try to add them to this someday), so you have to give the
coordinates of all the widgets.
I have not yet ported all the Showcase libui widgets. So far the list
of ported widgets includes:
generic buttons
radio buttons
tiny radio buttons
labels
bold labels
vertical sliders
horizontal sliders
text entry fields
scrolling text blocks (for selecting file names, for example)
pull-down menu (*)
(*) Actually, I just provide the menu bar, and what gets activated are
the GLUT pop-up menues. It works fine, except that the GLUT pop-ups are
not drawn in the same style as the rest of the MUI widgets.
There's one very weird thing in the code -- the MUI always draws stuff
using a sort of display list -- usually a very short display list. The
reason for this is that the Showcase libui was designed to run on
systems with as few as 16 colors. To get a bigger variety of colors in
the 16 color case, it would draw things twice with 2 different colors
and 2 different stipple patterns. So to draw pink if it only had red
and white, it would draw half the pixels in red, change the stipple to
hit the other bits, and then draw the same thing in white. If the
system had good color capability, it would just draw in pink.
I've tossed out the code that did multiple drawing, but the display list
structure is ubiquitous, so I didn't bother to rip it out yet. I
shouldn't take too long; I wanted to get all the widgets ported first
and then I figured I'd do the whole thing at once rather than
piece-meal.
I just don't want anyone to conclude that I'm a moron because of the
obviously inefficient drawing code. (There are pleny of other features
of the code you can use to see if I'm really a moron :^)
The code hasn't been cleaned up in the sense that I'd like to have the
only visible external names begin with "mui_". I'd also like to make
sure that the only include file you'll need is mui.h. And mui.h still
exposes too much. I've only used it for a small number of examples
(about 3) of applications, and each new one I do causes me to clean
things up a bit more.
-- Tom Davis (davis@sgi.com)
|