PDA

View Full Version : GUI



Dag Henrik
01-04-2006, 11:19 AM
I would like to write a simple GUI with textfields and buttons and so on. Are there are any good tutorials that adress something similar?

dorbie
01-04-2006, 11:58 AM
I have some GUI code in the example for the water rendering section of this book:

http://glbook.gamedev.net/moglgp/code.asp

Download the code archive for it, there's no tutorial on the GUI itself though.

Basically you follow mouse events and use it to track input focus (scaled to your viewport). Depending on the widget type you do different things on clicks and movements based on widget/mouse state. And of course you draw the widget in the right place altering appearance to reflect widget state.

Dag Henrik
01-04-2006, 02:06 PM
Thanks a lot, I'll check it out.

Dag Henrik
01-05-2006, 03:10 AM
Hmm, I found a directory called "water" in chapter 8, but it doesn't seem to work. There's a directory called "MGLTemplate" which has an executable, but it requires MSVCR71D.dll.

joshua_falken
01-05-2006, 06:22 AM
You might also want to note that there already are projects which implement standard GUI functions on top of OpenGL. One of them is GLGooey:

http://glgooey.sourceforge.net/

I do not, however, know whether it is currently still being maintained.

Joshua

01-05-2006, 08:41 AM
You can get the missing dll here:
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71d

Nice work, Dorbie! And thanks!

:)

dorbie
01-05-2006, 09:58 AM
Since the question was about a howto I thought some simple sample code would be preferred, if you actually want a gl based GUI off the shelf then there are obviously better options, something like FLTK for example:

http://www.fltk.org/

or even PUI:

http://plib.sourceforge.net/pui/index.html

Sorry about the missing dll, it's a known packaging issue that should have been fixed by now, since it's supposed to be for developers who *should* have a VS.NET dev environment installed I guess it's not seen as critical. The same dll is actually included elsewhere in the code examples.