View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# OpenGL GUI anyone? Updated on 11/17/05

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

207 replies to this topic

### #161relpats_eht  Members

Posted 14 October 2005 - 03:47 PM

well, the way I see it, the coder already has the option to not use the sliders built in label and place it anywhere they want using panels, so taking away the label option doesnt provide any new functionality, while leaving it doesnt subtract from functionality either. So, from those two options, I would suggest that it be left, though, to propose a third option, perhaps a choice of where the label appears?

### #162JavaCoolDude  Members

Posted 15 October 2005 - 06:20 AM

I will definitely think of that later on, thanks for the suggestions [smile]
I updated the main post with the new win32 binaries using the std::string class.
On a side note I'm about to start working on a project similar to DXUT frame work that you see a lot in NVIDIA SDK, only this one will use OpenGL and require a single header file and a single .lib
It will facilitate creating windows and will have this GUI built in :)

### #163JavaCoolDude  Members

Posted 16 October 2005 - 04:20 PM

Thanks to Mr Reiland for combining the win32 and linux files into a single package and tracking down the segfault on linux boxes.
I updated the main post and I cleaned it up a bit, check it out [smile]

### #164relpats_eht  Members

Posted 17 October 2005 - 09:07 AM

That first post sure is alot better.

I can't say I 100% approve of putting all class definitions in a single header, but its really a matter of preference (and something not hard to change if I want to), but otherwise, its looking great.

So, whats left to do on this GUI anyway?
Other than text areas and fixing up text boxes a bit and adding the ability to move windows, I cant think of anything.
By finishing up text boxes, I mean changing the start index of the text when the text overflows the box instead of just not displaying it, adding a max length to text boxes, allowing the blinker to be dragged to select text, and possibly clipboard support.

### #165sckoobs  Members

Posted 11 November 2005 - 10:17 AM

I found this thread a while ago when I was searching for a light weight and portable GUI for my game (and other projects) and I'm very impressed!

I'm currently trying to implement it into my game and was wondering what the status is on its development? notice I'm calling it 'it' a lot :) What was the official name in the end?

I have some Qs that someone could perhaps kindly help me with:

1. JavaCoolDude, you stated that you were currenly integrating this project into another one similar to DXUT, what is the progress on this? What are the implications of such a development?

2. Is anyone still actively working on this project?

3. Is there a controled source repository set up for development purposes? I ask because when reading the thread I noticed that JavaCoolDude said some things were fixed such as not being able to grab hold of the outside side (if that makes any sense) of the slider handle when its at the end of the slider and in the version I downloaded from the updated first post, that problem still exists. However the custom string issue seems to have been removed.

4. I noticed the sourceforge project page is up but its devoid of content, any plans to start using this?

5. I currently use FTGL (with freetype2), a font glyph renderer for opengl), to render text and I was wondering how easy it would be to merge this with the GUI, as I understand that the fonts are loaded from a .tga file at the moment, how engrained into the gui is the .tga (texture fonts I assume) functionality? Perhaps this should be another pluggable part of functionality similar to what was being mentioned about the proprietry texture manager? (everyone should be using DevIL anyway :P).

I guess I'm just concerned that this fine project will stop being developed. There are some things I'd like to add, including a list box widget, as well as clearing up the other things such as the text box issues that relpats_eht mentioned in his post (10/17/2005 4:07:18 PM), etc... and adding a text area, all if my humble programming skills are up to the challenge!

I also have this nasty habit of documenting things as I use them, to solidify my knowledge of them, so I want to write a user guide with tutorials/examples sort of affair but, what format should this take?

An absolutely superb effort guys!

### #166relpats_eht  Members

Posted 11 November 2005 - 01:36 PM

Well, the SF.net site could and should be used, but no one has ever contacted me about it, so it is just sort of sitting there.

Also, I am actively developing an AllegroGL port of it, which is a bit futher along than the version which can be downloaded from this thread. Not much farther though, all I have really done is reformatted all the code, removed all dead code, made the fonts not have to be upside down in the texture, and finished the textboxes. I am still working on it, but unless you use Allegro(GL) for your projects, it really wouldn't be of much use.

As far as changing the way it handles fonts, during my port, I found it was as easy as one large backspace and 5 new lines, and all of the changes where pretty much localized to the font loading function.

However, proper documentation for OpenGLUI (SXML GUI?) would be a good thing for everyone.

### #167mreiland  Members

Posted 17 November 2005 - 06:37 AM

Honestly I think the most important thing for OpenGLUI is getting the destruction of the widgets correct.

At this moment, there are a few key destructors that aren't being called correctly because they're not virtual, nor are their children virtual. If you do make them virtual, you start getting segfaults when deleting widgets. I think there's an issue with the order of destruction , ie, somethings being deleted that's a part of something else.

I really haven't had the time to look as closely at the code as I could, but I've thought of several solutions, ranging from complex to not so complex :) Ultimately what I'd like to do is use a tree container of some type to keep track of destruction order, et al. At the moment it's all handled by the widgets themselves. This would allow us to add/remove lifetime constraints much more easily. I also would like to more properly map out the constraints for the widgets. Things like exact lifetime, may only have 1 parent, etc.

I haven't really brought any of this up to JavaCoolDude, but I guess this would be the best time to do it :)

If anyone would like to discuss this with me, you can contact me at

AIM: mreiland1978
YAHOO: mreiland1978@yahoo.com

### #168JavaCoolDude  Members

Posted 17 November 2005 - 07:33 AM

Honestly I think the most important thing for OpenGLUI is getting the destruction of the widgets correct.

At this moment, there are a few key destructors that aren't being called correctly because they're not virtual, nor are their children virtual. If you do make them virtual, you start getting segfaults when deleting widgets. I think there's an issue with the order of destruction , ie, somethings being deleted that's a part of something else.

I fixed that in a newer version that's going up tonight [smile]

### #169JavaCoolDude  Members

Posted 17 November 2005 - 08:51 AM

Done.

### #170/ Shamino   Banned

Posted 17 November 2005 - 08:04 PM

Looks incredibly useful.

Dual PII 400 MHZ 512 L2 Cache (1mb in all)
512 MB of RAM
Gforce FX5200 128 MB

Runs ~200 FPS in initial size
Fullscreen (1600x1200) ~80 fps

### #171BlueHabu  Members

Posted 18 November 2005 - 08:55 AM

Ok i will admit i did not read all the posts in this thread but it did read few and did not see this posted anywhere.

Is this project LPGL, GPL? I want to modifiy the code and make my own interface so i can have it as an external library

On a side note -- It does compile with Visual Studio 2005 with some modifications to the project file.

[Edited by - BlueHabu on November 18, 2005 9:55:04 PM]

### #172MizRaeL  Members

Posted 18 November 2005 - 02:02 PM

good work man!

i've a small question..how it's possible to determine if the user clicked on the gui or in the normal viewport? (excuse me if it's too n00b, but i've just now implemented your lib and here it's 03:00 AM :P )

ok i've realized that this implementation works only if you're using glut, not with all the WinMain stuff.. There's something i can do? I really don't want to use glut in my project :D

[Edited by - b3rs3rk on November 19, 2005 3:02:24 AM]

### #173relpats_eht  Members

Posted 19 November 2005 - 04:27 PM

As for not using glut, you just have to write your own equivalent functions.

### #174JavaCoolDude  Members

Posted 19 November 2005 - 05:43 PM

Quote:
 Original post by b3rs3rkgood work man!i've a small question..how it's possible to determine if the user clicked on the gui or in the normal viewport? (excuse me if it's too n00b, but i've just now implemented your lib and here it's 03:00 AM :P )ok i've realized that this implementation works only if you're using glut, not with all the WinMain stuff.. There's something i can do? I really don't want to use glut in my project :D

To answer your first question, if a click on the GL canvas doesn't result into a message sent to the actionPerformed function, you know your GUI remains untouched.

Also Glut is not mandatory; I simply chose it because a lot of people are familiar with it. That and I didn't want to overdo things by adding my own window creation and user events management routines.
Check out my SXML Engine, it uses this same GUI package independantly from Glut.

Posted 22 November 2005 - 03:34 AM

First of all, my compliments to the coder. This looks greater than anyhthing else I have ever seen. Thanks for making it open-source.

>>> Now my newbie problems and questions.

[1] I'm trying to work with this, but I simply can't manage to do it. When I try to build the project it gives me stupid (at least for me) build errors
Quote:
 ------ Build started: Project: SceneGraph, Configuration: Debug Win32 ------Compiling...Main.cppd:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib(22) : error C2039: 'exit' : is not a member of 'operatorglobal namespace'''d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib(22) : error C2873: 'exit' : symbol cannot be used in a using-declarationXMLUtils.cpp.... and that error goes on and on for almost all the project files.

I understand that I will probably be missing something (probably very basic), but I can't figure what. Can anybody help me?
I'm building this on Visual C++ 7.1 with glut library, over win32.

[2] Where and how can I get the actual status of many menu options?
I understand that we are all asking for the moon and beyond, but some full tutorial would be wonderful.

[3] Is there any way to control the menus thru the keyboard, and not only by the mouse?

Hoping not to get boring, I will finish my post >here<

### #176MizRaeL  Members

Posted 22 November 2005 - 04:04 AM

it's possible to add and remove (or at least, disable) items during run time?
Basically what i want to do is to add a button if in the game is avaiable a particular resource. is this possible?

i've tryed with this:
  GUIPanel newPanel;  newPanel.loadXMLSettings(&TiXmlElement("BarracksButton.xml"));  guiFrame.addWidget(&newPanel);

but crashes during the rendering :/

### #177Ludi83  Members

Posted 22 November 2005 - 04:10 AM

Quote:
 Original post by b3rs3rkit's possible to add and remove (or at least, disable) items during run time?Basically what i want to do is to add a button if in the game is avaiable a particular resource. is this possible?

You can make the widgets visible/invisble. I don't have the method name in my brain right now, but it's in there :)

### #178MizRaeL  Members

Posted 22 November 2005 - 04:44 AM

works perfectly! i don't know why i didn't thought it before :D Simpler solutions are always out of sight :P

### #179JavaCoolDude  Members

Posted 22 November 2005 - 05:38 AM

You need to allocate your widgets on the stack via the new operator, otherwise your application will most certainly crash =/
Like suggested you can use the visibility flag via setVisible(bool).
PS: Any screeshots? :D

### #180MizRaeL  Members

Posted 22 November 2005 - 10:18 AM

thanks :D

just wait a day or two, i've exams at the university, there's quite no time to code :/

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.