Please help me with some IO problems

I’m really new to OpenGL and I’ve come across something I can’t figure out. I’ve just started writing very simple OpenGL applications (like drawing shapes, rotating, colors etc…)

I am trying to use some IO with my current program. I want to draw a very basic picture in a
window. I want to be able to allow the user to enter in a number. Then I want to rotate my image that “number” of degrees in real time.

I know how to do all the graphical stuff, but I can’t figure out how to set up the IO for this. I tried putting some “cin/cout” statements in my code to prompt for input, but all I got was errors. I don’t want to use the mouse or have “hotkeys” on my keyboard for predetermined results. I want to be able to enter in data in one window using menu’s (like in a dos shell enviornment), and in another (simaltaneously open) window have the picture displayed and altered.

Is it even possible to set it up like that? I’m also pretty new to C++ (I use visual C++) My experience has been with console stuff. Any help at all would be greatly appreciated because my teacher doesn’t know how to do it in OpenGL (he want’s me to use the BGI library under Turbo C) and my book doesn’t cover it.

If you can help (on this board or in email), please explain it as simple as possible because I’m pretty new to programming in general. Thanks a lot!


When you start a windows program, it does not have an associated console by default. Therefore you don’t have a stdout or stdin, and printf, cin, cout to these descriptors won’t work. The ideal solution would be to build a pop-up dialog with a text box that enters your value.
If you really want to have a console associated with your app, look in the win32 sdk with your visual C++ under the console library. They are a set of routines that allow you to create a console, read/write to it, and connect it to stdin/stdout. Haven’t done it, but I have thought about it, since it makes debugging a pain not to be able to printf in one’s program.

If your using Visual C++ and presumably the MFC support classes you might want to try creating a modeless dialog box with a text box/window for input.

A modeless dialog box can coexist with other windows and doesnt grab the control of the program.

you can then set up the program to update the view whenever a change is made via the dialog.

you need to be fairly familiar with VC++ to do this kind of stuff so you might need to look for additional help/documentation.