I just published the immediate mode user interface (IMGUI) toolkit that we are using in our latest OpenGL SDK examples.
The purpose of the SDK examples is to show how to implement certain techniques using OpenGL. We did not want to spend too much time writing UI code, and we did not want the UI code to end up occupying more space than the code dedicated to the technique we are trying to showcase. IMGUI allowed us to accomplish these goals in an elegant way.
Here’s a simple example with two widgets:
ui.begin(); ui.beginGroup(nv::GroupFlags_GrowDownFromLeft); static bool showButton = false; ui.doCheckButton(none, "Show exit button", &showButton); if (showButton) { if (ui.doButton(none, "Quit")) exit(0); } ui.endGroup(); ui.end();
And this is what the result looks like:
[missing image]
One of the nice things is that, since the UI is being rendered in immediate mode, it’s very easy to create/modify widgets dynamically. For example, this is what happens when the check box is activated:
[missing image]
You can get the whole source code at the nvidia-widgets google project, and feel free to drop by the Molly Rocket IMGUI forums to share your feedback!