View Full Version : Heads up display (HUD) dynamic text input
08-17-2011, 11:13 AM
Hi I am new to OpelGL, but have been using Opencascade with Qt. I am developing an open source CAD tool kit on Linux using C++. I want to show sketch dimensions etc using HUD for example like so:
I have looked up links on google to show a HUD, but didn't help much. I want the HUD to be dynamic and the user should be able to interact with the text displayed more like a text box shown in the above link. I have no idea how to proceed. Any suggestions to implement this is is greatly appreciated. Do I have to use SDL? please help.
08-18-2011, 04:49 AM
I can't get to the link you posted, but anyway OpenGL is a graphics rendering API. You can certainly create text box GUI widgets and others as I have no problem (OK, quite a lot of code actually).
To get keyboard input you'll need to use the underlying operating system or some API which allows that kind of thing (SDL can help there). Keyboard interaction is one of the easiest things to get a handle on so SDL may be an overkill just to type some text.
08-18-2011, 07:54 AM
Thanks for the reply, yes I understand what OpenGL is, only thing is used little OpenGL in coding, but I think now to realize HUD, I need to use OpenGL more, I know commercial windows based software used DirectX in softwares like AutoCAD to do this, but since I am more a newbie to OpenGL, I don't know how to proceed.
So you I better use SDL for even handling? since I handle my GUI related events using Qt, will SDL event handling interfere with Qt?
Also please see attached images, please note the text being input in the textbox like HUD display on the canvas, this is great for the reason that, I don't have to have a separate GUI textbox and this is integrated into the whole sketching philosophy. I wish you or someone can show me a way.
08-18-2011, 08:08 AM
I'm afraid I don't use SDL, Qt, Glut or any other 3rd party DLLs. Every thing I do I do from scratch which gives you total control and no dependancies upon anyone else maintaining their code base. However, it is more work.
You can write a simple text box in OpenGL and use the Operating system to read the keyboard. I won't lie to you - some of these things get a little tricky and that's where GLUT or FreeGLUT libraries can help, etc. I'm afraid I can't advise more than that.
08-18-2011, 08:36 AM
Thanks Bbytes, appreciate your input, the only way then is to try the hard way.
08-18-2011, 11:55 AM
the only way then is to try the hard way.
No, it's not. Just because one person decides to do everything themselves does not mean that you should. You should only do that if you need the level of control that approach offers. And that's not common.
SDL or SFML can provide you with cross-platform tools for window management, input control, and a variety of other things, which will allow you to focus on actually getting done the stuff you want to get done rather than the various minute details of just getting a system up and running. These are good libraries with reasonable APIs and cross-platform support.
While I personally don't like Qt, it is also a legitimate alternative if you are making an application that creates GUI widgets. Most games, for example, don't use native GUI widgets; they draw all their stuff directly. But some applications, like modelling or CAD apps, need to use native GUI widgets.
08-18-2011, 01:21 PM
I understand what you are saying, infact I can't obviously make everything from scratch and also my application is already in advanced stage. I just was referring to Heads up display functionality, since I have no examples I can follow, I thought of doing it the hard way of trying from nuts and bolts. I did find some openGL snippets on google, but nothing concrete in a way of what I need. Those examples I saw are for games, where in they just display some game related info. But my intention is to have a HUD which is interactive-> display dimensions, change them and that change should trigger an event of drawing to the input.
Since my app is opensource and I am familiar with Qt, it was my choice, since I read somewhere that SDL can be used in handling events, I thought of taking SDL route, but I have no clue how to mimic the functionality posted in the images above.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.