Code for getting text input in OpenGL

Is there a code for getting text input from users in OpenGL?

1.I’m trying to get the user to input their text
2.My program responds and chose a texture based on the text (texture name) that they chose.
3.Renders it

I know how to do textures, but i didn’t know how to display the message and get user the user’s text input. Plz help.

You can check NeHe’s tutos about displaying text in OpenGL window, there is many way…

NeHe webpage

Originally posted by PhoenixByte:
Is there a code for getting text input from users in OpenGL?
Getting input is the tricky part.
First thing, you could try using win32 console control functions (this is ugly but it could be useful until you have the real thing running).
GetStdHandle, AllocConsole and FreeConsole are some functions you will need. Also check ReadConsoleInput and stuff like that.
For each loop, you could check for console input, parse it and send it to the render loop.
Getting text input without the ugly console is actually pretty easy. The not-so-easy thing is managing it right.
Win32 sends a WM_CHAR message every time a character is generated. This is good because
1- It also handles ALT+N (useful to generate ascii glyphs like } we all love or ~).
2- It handles repetition rate nicely (so users will find the repetition rate it’s just like notepad or their favourite editor).
3- Other minort things I don’t remember.

Some things however are nasty.
For example, while it gives you characters, some chars does not produce glyphs. Backspace is something evil. “up” and “down” is worse. “left” and “right” will make you run out screaming but you may find you don’t need so evolved functionalities.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.