PDA

View Full Version : Input values to Opengl program



Imaging
03-22-2006, 07:02 AM
Hi, I'm currently designing a program that will require a specific number of files to be loaded into it, I however don't want this number to be hard coded into the program. I was just wondering if there were any ways for the user to input this value. I've looked into message boxes and that but I can't seem to find anything to allow user input. Any help is much appreciated.
Cheers....

Y-tension
03-22-2006, 07:36 AM
If you're programming in windows you can use an "edit" control and read back the value the user has entered in runtime through the window procedure.I think there must be something analogous to Linux.

Ehsan Kamrani
03-22-2006, 08:28 AM
The solution is dialog boxes. The book *OpenGL Game Development* has explained such topics.
-Ehsan-

Overmind
03-22-2006, 08:33 AM
When the program should run automated, you could use a single hardcoded configfile that contains the names of the other files. This would be most simple to implement.

If you want it interactive, you have to use dialog boxes. Most GUI libraries have pre-made "open file" dialogs, but this can still get rather complicated to implement.

If you use GLUT, you can use GLUI to implement a simple user interface.

A comromise that's not so user-friendly but a lot easier to write would be to use commandline arguments via the argc/argv parameters of the main function.