View Full Version : I have a question regarding giving input name in a window box
11-15-2003, 10:11 PM
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
11-15-2003, 11:19 PM
11-17-2003, 05:29 AM
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.
11-17-2003, 08:56 AM
I am usign visual c++ environment to use opengl program. so can you tell me what commands can i use for a imput box
11-17-2003, 09:27 AM
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:
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...)
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).]
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.