PDA

View Full Version : OpenGl Menus, Buttons, etc



gdboling
02-04-2004, 10:58 AM
I'm looking for some tutorials/information on how to construct OpenGl driven menu systems and common widgets. I don't want to use GLUT or other Windowing Toolkits. I want all the components to be rendered in OpenGl.

Thanks for any help.

Gregg

MrShoe
02-04-2004, 10:30 PM
OpenGL does not support a GUI system as such, its a graphics library, not a GUI library. What you would need to do is write your own GUI class or something, using polygons and textures for buttons.

gdboling
02-04-2004, 11:32 PM
Originally posted by MrShoe:
OpenGL does not support a GUI system as such, its a graphics library, not a GUI library. What you would need to do is write your own GUI class or something, using polygons and textures for buttons.

That's what I am talking about.

JanHH
02-05-2004, 05:33 PM
Then go ahead and do so http://www.opengl.org/discussion_boards/ubb/wink.gif what exactly is your question?

what also came to my mind: why do you want to do that? to have fancy 3D widgets? I find the idea quite interesting.. and on HOW to do it: just think of how you would construct a gui library at all, which is surely not a trivial task. For example, take java swing and try to understand how that works (it is, in my opinion, the GUI library with the cleanest OO design that I know of).

A problem could be that you do need a GUI library to get an OpenGL rendering context at all, so all you can do is a GUI insider another GUI.

You need an Object hierarchy of your widgets (windows, buttons etc.) and a message loop that reacts to events that happen inside of your OpenGL window (mouse clicks inside of that somewhere), then somehow find out which widget it was the mouse was clicked on, and in general do a lot of dirty work yourself which normaly the OS/GUI does for us. But it might be fun as well (at least, I would find it to be so).

Jan


[This message has been edited by JanHH (edited 02-05-2004).]

Obli
02-06-2004, 08:05 AM
I once stumbled on a thing called GLEW which looked pretty good. If you like it, I guess you'll be able to do whatever you need.

lulf
02-06-2004, 08:42 AM
Well, you should try out QT, it includes opengl support.
www.trolltech.no (http://www.trolltech.no)

gdboling
02-06-2004, 09:26 AM
Ok people. Haven't you ever played a game where you had to choose preference and video settings and what not from within the game. Games like Battlefield 1942 comes to mind. All their menus and options are OpenGL.

Now I know that OpenGL has no built in support for event handling. But all I wanted was to know if someone had any good links for creating menu and/or widget systems in OpenGL without using a Windowing Toolkip like GLUT, QT, etc. I don't mind using the event processing methods of these toolkits. In fact, I will probably have to do to get click events to respond. But I don't want those toolkits to draw anything.

I want to make an Opengl 2D rectangle with some text for a button. Things like that. But I would like to have some links to some information on how to process click events and different methods for developing these types of things.

MrShoe
02-06-2004, 05:05 PM
Now your just asking us "How do I write code that draws stuff"...
well, youir gonna prolly need to write yourself a font class first. Then your gonna have to write a gui class which is uses the font class. yo uhave objects such as a button, and it has methods like "Draw()" and it has variables like the extents of the button where you can click it...
I mean, really, it would be easier to write it than it would be to explain to you HOW to write it.

JanHH
02-06-2004, 05:29 PM
a BIG difference in your project is whether you want to write a complete programmable GUI library based on OpenGL (what I first thought) or you just want some buttons and menus. The first is pretty complicated, the second rather trivial. I guess it's really best if you just start working on it and make your own experiences. I really guess this is so easy that this is the reasons why no libraries or tutorials exist on this (maby they do, I don't know).

I think you should really sit down, relax, and think through what you are wanting to do.. what you really want, and how to achieve it, and how to design it best. Maybe YOU are the one to write an OpenGL based standard GUI toolkit http://www.opengl.org/discussion_boards/ubb/wink.gif. But I really think it is not very hard at all, once you figured out a good object and design structure.

Jan

gdboling
02-06-2004, 06:15 PM
So in other words no one has any good links, sites, references regarding this.

Ok, thanks anyway everyone.

02-07-2004, 01:14 PM
Try here
http://nwaldren.bei.t-online.de/glgooey.htm

Mat

nexusone
02-07-2004, 03:33 PM
This is something that people have requested, I have thought of a writting a simple tutor on the subject but have not.

To create your own openGL driven menu's all you need to do is learn how to use textured quads and how to read the mouse(which is not a openGL function). There are lot's of tutors on reading the mouse which Windows code, glut, SDL, etc.

You can ether draw text to the quad or create a bitmap image of how you want to menu to look then just read the mouse as to where on the bitmap the click has happened.

It is not really that hard if you just take the time to learn openGL basic programming.

nehe.gamedev.net has all the information needed to create a game menu system.



[This message has been edited by nexusone (edited 02-07-2004).]

gdboling
02-07-2004, 03:44 PM
Originally posted by nexusone:
This is something that people have requested, I have thought of a writting a simple tutor on the subject but have not.

To create your own openGL driven menu's all you need to do is learn how to use textured quads and how to read the mouse(which is not a openGL function). There are lot's of tutors on reading the mouse which Windows code, glut, SDL, etc.

You can ether draw text to the quad or create a bitmap image of how you want to menu to look then just read the mouse as to where on the bitmap the click has happened.

It is not really that hard if you just take the time to learn openGL basic programming.

nehe.gamedev.net has all the information needed to create a game menu system.

[This message has been edited by nexusone (edited 02-07-2004).]

Thank you for taking the time to respond to my post. I have been to nehe several times. Thanks for the information.

nexusone
02-07-2004, 05:06 PM
No problem.

Just like to add, a good paint program like Paint shop pro. Comes in handy for creating your images for menu's, buttons, etc.

Look at nehe's tutor's 32 and 33, which go over loading images to quads and some game logic.



Originally posted by gdboling:
Thank you for taking the time to respond to my post. I have been to nehe several times. Thanks for the information.