OpenGL GUI anyone? Updated on 11/17/05

Started by
206 comments, last by Alpha_ProgDes 17 years, 10 months ago
Hi, I've been messing around with OpenGLUI and have got it working within my own framework. It's based on SDL, and it was pretty simple to write a function to convert SDL events to ones for the GUI. It doesn't handle all cases, but does the things the glut demo does - mouse clicks and key events. I've also made a new vc2003 project file that builds openglui as a seperate lib (with some changes, see below).

Big thanks to JavaCoolDude for a great piece of work!

I do have a couple of suggestions to make things more convenient though:

Take GLee and TinyXML out of the gui lib code. I was already using TinyXML, and an extra copy of it in another header was a pain. Similarly there's no reason to build GLee into the gui. I can see why it was convenient to do it that way so that people could just download and use it without having to get the dependencies to compile seperately, but for existing projects modularity is key. It was just a matter of removing the GLee and TinyXML code from the gui files and linking to the existing GLee lib and a lib version of TinyXML I built.

I'm happy to release my work on all of the above if anyone would find it useful. If JCD doesn't have the time or inclination to make it more modular (man, he's already put in lots of work for everyone else's benefit), I'd be happy to help.

One last thing: running OpenGLUI with glintercept it looks like your font code isn't releasing it's textures or display lists. That said, so does my framework, which uses FTGL. Maybe a common ancestor in font code, or maybe a problem with glintercept.
[size="1"]
Advertisement
The only reason why I decided to merge TinyXML into the XMLUtils files is because I didn't want the final user to deal with a great lot of files while including this GUI into an existing project.
About the fonts not being released properly, I simply forgot to add a clear function to the GUIFontManager. Let me go ahead and fix that up.
PS: Woah what happened to the forums look =)
Quote:Original post by JavaCoolDude
The only reason why I decided to merge TinyXML into the XMLUtils files is because I didn't want the final user to deal with a great lot of files while including this GUI into an existing project.

Yeah, it was a very good decision to lower the learning curve. On the other hand, it causes problems for people who already have an extension loading mechanism in place, or who are already using TinyXML. Actually, it's probably only a problem for people whose projects are built from several libs, I guess if you're building a single exe and simply adding all the gui code to the project it's fine.

I do think though that there's a lot of code in there that doesn't need to be. That's entirely understandable, because you wrote it for your own use. In fact for many people the extras probably add value. Would you mind someone producing a stripped down version, possibly for the sourceforge site? I may be being presumptuous, but I think a more compact version may be useful to others as well.

Quote:Original post by JavaCoolDude
About the fonts not being released properly, I simply forgot to add a clear function to the GUIFontManager. Let me go ahead and fix that up.

Great stuff, thanks. And thanks again for releasing your work. I have spent quite some time evaluating various GUIs for opengl and this is by far the best, both in terms of features and clean design.
[size="1"]
still fighting with your gui :D (again great work!)
small question: i've a panel that contains only buttons. is it possible to set the dimension of the panel and have something like a slide bar ? this way some buttons are visible and others not, and the user has to lower or raise the slide bar to show those..

Or maybe using buttons instead of text items in a combo box...


P.S. a demo is coming! :D
i think i've found a bug: seems that the TABBED_PANEL message is never sent, though the tabbed panels work perfectly.. but this way i don't know how to capture the widget message :/
Indeed that message is never sent because it's captured by the TabbedPanel and redirected to its subcomponents: It was the easiest, most-obvious solution to implement at that time.
=/
doh -___-

this is a problem because when i want to move a unit (a tank or a jeep or whatever it is) and i click on the map, everything works fine. if i click on a button it's the same, but if i click on the tabbed panel the selected unit moves to the zone of the map directly under the tab :/
A temporary fix would be to retrieve the windowBounds of your tabbed panel and cancel your orders if the mouse event falls within that area.
void SceneFrame::mouseClicked(MouseEvent evt){   guiFrame.checkMouseEvents(event, Mouse::CLICKED);  if(userControls)  {    const Tuple4i &windowBounds = userControls->getWindowBounds();    if((evt.getY() >= windowBounds.y) && (evt.getY() <= windowBounds.w) &&       (evt.getX() >= windowBounds.x) && (evt.getX() <= windowBounds.z) )      return;  }}
I feel so noobish :( But I downloaded the zip file that is linked to in the first post, and I just saw the scengraph project file (visual studio is what I'm using). I opened it and it wouldn't compile because something about a wrong opengl function (I think it's some headers I changed), but then I assumed that that project file was for the actual demo of the GUI. So my question is, is there a library I'm supposed to compile, or do I just use the headers/sources...sorry, I'm just lost. :(
You should be able to use the vcproj file and compile the project right away.
I'm not sure about the GL function error that you were getting; care to elaborate a little more on the issue?

This topic is closed to new replies.

Advertisement