I have an OpenGL game and and I want to implement a simple way for the user to enter data/text in an input box. What is the easiest method to do this?
OpenGL is a rendering system. Rendering has nothing to do with getting text input. If you want text input, then you're going to have to use a library or OS system that provides it.
SDL, Allegro, SFML, and most of the other "multimedia" libraries all have some means of getting input from the user. They're also cross-platform, if you're into that sort of thing. Even the "toy" libraries like GLFW and FreeGLUT have ways of getting basic input.
As for the "text box" part, that's going to be more interesting. Generally, if you're making a game, you don't really interact with the native windowing GUI. So you either have to use a specialized GUI library like CeGUI, or you have to write the text box code yourself. I would personally suggest investigating game-GUI libraries, as writing a GUI yourself is not particularly fun.
I have a 20-year old GLUT program. I need to support command line entry. My solution is epically nasty: I edit the text in the window title bar.
I used the ESC key to toggle a command-line mode. In this mode, the mouse symbol became the text entry bar, and the the current prompt and text was displayed using
glutSetWindowTitle(). You can only get the conventional ASCII 7-bit printing characters. I support the printing characters, DEL, and RETURN. I have command history using the arrow keys. There is no cursor symbol, so the only way of moving back is to delete.
The default centres the text. I got left justification of the prompt by appending a lot of spaces.
The title bar supports ASCII 20-7E and unicode on my Mac. I guess the title bar is rendered by the OS, so there is a good chance unicode will work most systems.
FreeGLUT lets you exit the render loop and get back in again, so you can edit strings in the terminal and submit them to the render. My build already had GLUT in the Nvidia tools, so it was easier to use that, but YMMV.
I don't know, if you want to use just OpenGL or it's also possible to use other libraries. If you can use others, you can try AntTweakBar - gui library for OGL. I have never used it for text input, but there is also string type for variables, so it should work.
You just create bar, add there variable of type string and set callback. When data are changed, you store them to your own variable. Then you add there button. When user presses it, you will just use stored text to whatever you want.