PDA

View Full Version : user input/output



09-18-2005, 07:24 AM
I'm very new to Open GL, and I'm using an already existing Polygon-Drawing program (it draws a filled-in rectangle given hard-coded coordinates) and trying to modify it so that it will take user input-- the number of sides and the diameter, and then it is supposed to draw the polygon.
My question is, can OpenGL take user input from the command line using printf and scanf? The only place I can put this code is in the main method, but there seems to be no way to pass the parameters to the display method where the polygon will be drawn.
I also tried keyboard input, using processSpecialKeys, and processNormalKeys mnethods, but I'm not sure if that works with getting user info from the command line, and if not, how do I ask for what I want from the user? using those keyboard methods?

Thank you very much in advance for any information you can give.

~Krista

mikael_aronsson
09-18-2005, 08:48 PM
Hi !

OpenGL cannot handle any input at all, that is up to your application and the OS, and by the way what kind of platform are we talking about (Windows, Linux, UNIX, Mac...).

An OpenGL application is not any different from most other applications, to get output you need some kind of display function that ic either called from a thread or loop (games and things like that) and others get called when something changes and there is a need to change the output (glutPostRedisplay, repaint, InvalidateRect for example), as long as you do not mess this up you can handle input like in any other application.

Mikael