I have a question regarding giving input name in a window box

I am developing a game in C which uses OpenGL library. I want to know if there is some command in OpenGL/C where player of the game can enter the name in a input box. I know that there is such command in VB as inputbox but i am looking for C++ or VC++ environment.

if anyone could help me in this it will be really helpful


You can use a textbox with Win32 code in C++, but if you want to do that, you should have your Win32 controls in a different window context than the OpenGL display. (e.g. initialize a static control to display the OpenGL.)

If you’re coming from VB, you might want to play around with Windows programming in C++ a bit before trying to get too far into OpenGL. If you are using VC++ 6.0, you might be comfortable starting out looking at an MFC dialog box app. If you are using the 2003 version of VC++ .Net, they added better support for their .Net Windows Forms, so you might want to check that out instead.

Or, you could always just start looking at the Win32 API, but coming from VB, I’m guessing trying to learn that would quickly lose you.

I am usign visual c++ environment to use opengl program. so can you tell me what commands can i use for a imput box

Maybe I wasn’t clear. It’s not as simple as using a command. OpenGL has no input boxes of it’s own. It’s designed to be much lower level than that. The Win32 controls have a text box, but you generally can’t use Win32 controls in the same HDC as OpenGL.

I can’t just tell you how to do it, because there are a number of options, many of them having to do with how you are creating your window.

Your general options are:
[ul][li] Create your own OpenGL “control”, whereby you get input from the keyboard using one of a number of methods (WM_KEYDOWN messages, AsyncKeyState, etc) and display the text in the “control” using one of a number of methods (Bitmapped fonts, texture mapped fonts, etc.).[*] Use the operating system specific text box control. How you implement this in your code depends entirely on what you are using to create your window. (MFC, Win32 API, glut, etc…)[/ul][/li]
Again, I would suggest just trying to learn a bit more about Windows programming in general before trying to get too much into OpenGL.

[This message has been edited by Deiussum (edited 11-17-2003).]