View Full Version : User input in OpenGL
07-19-2012, 06:34 PM
I am wondering if OpenGL allows you to get user input from the terminal in traditional sense (i.e. std::cin>>). My program requires user input on several occasions in its execution, and I would like to know what is the most commonly used means for getting ascii character user input in OpenGL.
07-19-2012, 06:56 PM
OpenGL has nothing to do with user input. It neither inhibits nor aids your ability to use the command line, or any other form of user interface.
07-21-2012, 10:40 PM
The issue that I am facing in that the user input in my program prevents the graphics from displaying. The first part of my program draws a single line. When I comment out the first user input (std::cin) and everything beyond, the line displays normally. Otherwise, all I get is a dark window. Do you have any explanation?
07-21-2012, 11:49 PM
Yes, reading from std:cin blocks your application (at least the current thread) until the requested user input is available. You either want to move your rendering to another thread or use some sort of asynchronous input mechanism like GetAsyncKeyState on Windows.
07-22-2012, 02:00 PM
Thank you for clearing that up. On that note, I am wondering what method I might use to move the rendering to another thread or, alternatively, what asynchronous input mechanism is used on Linux.
07-23-2012, 02:53 PM
You can simply embed you application in any gui? WxWidget is too mainstream?
Then you have dialog, slider, text field.
Otherwise if you need a really easy and simple GUI you can use anttweakbar. link -> http://www.antisphere.com/Wiki/tools:anttweakbar
07-29-2012, 12:55 AM
Hmmmm... I guess wxWidgets would work. The program already uses an X11 window for rendering, so it may be better to simply add GUI to the existing window. Does GLUT have any input options that might work?
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.