file opening functionality in opengl
With a little thought of whether this forum is correct for my question, i posted it finally.
In my OpenGL programs, I had to read in few data files before i start rendering to screen. Until now, I include the file name directly in my program using a file pointer. I would like to know if there is any possible way to open a file from my local computer by clicking a button followed by going to the directory i wanted and then selecting the file I wanted - Just like other applications in windows or for that matter any platform. I would just have to provoke the file open window from my local system, using opengl. I have both GLUT & GLUI with me. I could even use it in my code if necessary. I appreciate if some one could help me out from my situation. I do coding using an SGI environment in C programming language (not C++).
If I am not clear, here goes an example. I need to render something on the screen after reading the coordinate positions from one of the data files residing in my local computer. Through some kind of call back, I have to provoke file open function of the OS and select the file I needed through a list of directories. I render something on the screen after reading the file I select it from the file open function. Once rendering is done, if I need to render some other data file, I again need to provoke the file open function through a call back and render the newly opened file now. I hope i was clear enough. Can any one help me?
Re: file opening functionality in opengl
OpenGL is purely a graphics API, so has no utility functions like you described. for something quick and easy, there is a Windows API function to bring up a File Open... dialog. i can't remember the function name right now, but basically you populate a structure with some initialization data, call the function which pops up the File Open dialog, and after you have browsed to the directory and selected the file, the function returns a handle to the file. search the VC help for the API function. for any other OS, they would have their own similar API function.