I have a private project with OpenGL 3.1. So far I can render scenes with simple and complex object forms described by a mesh. The next thing is, I would like to have a GUI and I prefer to implement by my own.
I guess all widgets in actual games are self written code. My question is: How did they realized it, for example with a text box or listbox? I mean, how to make text visible (with textures)? Or there is a technique to use the widgets of the operating system?
Thanks in advance.
I implmented my own text, font and widget rendering code.
I use a texture atlas for the font and use displaylists to build up the texture coordinate for each character, and render as a quad.
Widget rendering is more complex, particulary with things like combo boxes which are really two sets of controls (the click arrow and the list box). My advise is to start by keeping things simple and easy to implement. More complex controls are then multiple collection of individual controls which all share the same texture atlas.
Responding to mouse events is where things get real interesting - but basically you just need to define a rect for the area of the control to render, a rect for the area to respond to the mouse and a set of event handlers to react to mouse over,mouse enter, mouse exit, draw, update, etc.
There are 3rd party solutions to some of these, and whether you you them depends upon your specific needs and whether you need cross-platform support.
Thanks for your answer. I hoped that I could use the advantage of the OS. So you render every letter inside a textbox after the corresponding key was pressed?
So I see it is lots of work if you want to use language specific letters…
Can you please tell me, where I can find the bitmaps for the letters? I guess, you used mipmap techniques…
Where can you find the letters?
That’s the easy part. Just type them in your favourite art package. Even ms-paint has a font tool where you can type all the letters and symbols you need and in any font.