Hybrid GUI Beta
May 21, 2008
As some of you may have read, I’ve released a beta version of my new GUI toolkit, Hybrid.
The projects section of my website has been listing Hybrid for quite some time, yet that version was merely a prototype. The current one is actually a third installment of my OpenGL-powered GUIs. Be it a photon mapping program or some interactive walk-through, I’ve always wanted to have an in-game / in-engine GUI to play with. Using external controls, such as a separate MinWin pane next to my OpenGL context just didn’t feel right. So I rolled my own.
The first one was a rather classic retained-mode GUI that could make pictures such as:

It also had a more grayish look. Nevertheless, what pissed me off the most about its programming model, was that I had to create tons of wrappers, ‘GUI action handlers’ and separate the program into GUI init, action binding and event handling. In some cases it would’ve been much nicer to just inline e.g. the button actions in normal code, somehow.
Then I watched the excellent video about Immediate Mode GUIs from Casey Muratori, read some of the posts on Molly Rocket’s forums and decided that I wanted an IMGUI too. But I didn’t like all of the features of a classic IMGUI, such as the manual ID management, stuffing all logic of widgets only in functions and delegating a lot of power to the widget, instead of something that looks upon it. Of course, there were alternatives, some were even proposed in the follow-up posts.
So the idea was to create a GUI that lives somewhere between immediate and retained modes. The API must be immediate mode, but widgets should be able to store any state behind the scenes without the user programmer explicitly saving it somewhere. I wanted to be able to define widgets as simple classes, by overriding a few methods and leaving the rest to a common base. This is how the prorotype of Hybrid was conceived. It turned out ot be a bit messy because of some rather weird design choices at the very beginning, but it worked really well for Deadlock and some toy apps, such as a draft of a shader editor:



It was pretty pleasant to work with, in general. Yet, some ID management quirks were still there, and well – it was just a prototype.
Some time after finishing Deadlock, I took a univ course in ‘Software Analysis and Engineering’. After complaining to the lecturer, that the Waterfall model is not the best thing around, I was asked to make a non-standard project for the course. Most other folks on my year got project assignments and worked in teams. My objective was to create … documentation for Hybrid.
But well, who creates user-docs for a prototype? So I took the opportunity and rewrote Hybrid from scratch. This time I needed it to support some retained mode constructs in addition to the immediate mode API.
This is the result. And it makes nice pictures too:
So what’s the future of Hybrid? As written in the TODO, I’ve got some things to implement still. Probably easy style and css-ish widget-class management is going to be the most important. Animation of arbitrary properties will also be a must-have if it’s to become a useful game GUI toolkit. On top of that, I’ve got some widget orders that I need to deliver, such as a color picker… I’m considering (s)RGB + XYZ + HSV + Spectrum – based picking :P
There also remain a few usability and stability issues, but that’s the reason it’s a Beta and not a final release.
Filed under: Uncategorized | Comments (8)
This is great news, Tomasz! After reading your article on font rendering I was very much looked forward into this project, and finally it hit beta stage. Any chance to see more articles on related subjects?
OMG!
It’s alive! :D
dyh: I dunno; what would be the potential related subjects to write articles about? :D I still have little idea if the text rendering article was considered any good by the general audience. I had some feedback saying that it was complicated as hell. I’m glad you liked it! ;) Perhaps I could write some more stuff about Hybrid, since the ‘custom widget/layout/theme’ tutorials are rather minimalistic.
Well, it would be excellent to see series of articles based on development of an IMGUI application.
Something similar to “Design and Implementation of a Win32 Text Editor” (http://catch22.net/tuts/) series of articles – I really love style and comprehensiveness of this one.
Actually there are lot of subjects lacking attention of good authors – my favorite missing article is “scenegraphs and runtime game objects management”. Or something like that =)
The series does really look pretty nice at the first sight. Yet it seems to have been created on the course of two years, and Hybrid is likely to evolve a lot during this time. I’m afraid I’d be spending way too much time updating the old articles. But I’ll be making tools for Deadlock using Hybrid, so perhaps I’ll just blog about parts of it, including code samples, during their development?
As for scene graphs – that’s a good idea indeed. But it would have to be something along the lines “how we did it” instead of “how it should be done”, because everyone seems to have a different idea about scene graphs.
Yes, that’s what I’ve meant. James (author of “Text Editor” series) have stated from the very first article that he rather describing his experiences implementing the application. He doesn’t hided fact that original ideas and decisions could be evolved or even invalidated later in the series.
Ah, cool :) Well, going step by step and explaining every bit of the app would be pretty insane. I’d just tackle some bits of it. I guess I may do it when coding my visual shader editor :)