Process keyboard input

Hi,
I am new to opengl and I would like some help on how to process keyboard input. I am using Win32 to run my opengl programs. In console application, the code bellow:

int x;
cout<<"
Please enter an integer.
";
cin>>x;

allows the user to interact freely with the program without any predefined cases. I would like to know how to do the same thing in opengl.
Thanks.

Well, “cin” will stop your execution flow wait for input. There are two other slightly similar ways of doing it. Either you use the Win32 event-based model and capture an OnKeyPress-event, or whatever they’re named, or you run a console app. and do something like:

if(kbhit()){
char ch;
ch = getch();
switch(ch){

From what I understand, you can also use GLUT: http://www.xmission.com/~nate/opengl.html. Or, horror, DirectX’s DirectInput.

Thanks for your help, I will try to do what you’ve said.

GetAsynchKeyState() is much faster.
Joe