PDA

View Full Version : Trying to do text input for OpenGL but didn't know the code



PhoenixByte
02-19-2005, 06:55 PM
This is what I'm trying to do:

1.Display the message requesting user to choose the texture they wanted
2.User will type in which texture
3.My code accepts it and change the texture
4.Renders the scene / object

Before this I've tried using cin and cout before the renderscene but it didn't work. Someone told me to use Winproc instead. The problem is, I didn't know the code to that or how to do it. Been searching everywhere for it but to no avail.

Is there any tutorial I can use which teaches how to get text input from the user for OpenGL? Please help.

Overmind
02-20-2005, 03:16 AM
OpenGL itself has no text input or output functions. You'll have to write something yourself...

For outputting text I recommend FTGL:
http://homepages.paradise.net.nz/henryj/code/

For inputting text, you have to read single key presses and assemble them to a string yourself. How to do that depends on the window toolkit you use. For example in SDL you get a keyboard event when a key is pressed, or in GLUT you can register a callback function that gets called when the user presses a key...