In two weeks of fussing with "freeglut", I have made a bunch of changes and have uncovered some remaining issues. I have a ZIP file containing my updated source code for anybody who is interested. I have run the GLUT demo programs--usually just changing the "#include <GL/glut.h>" to "#include <GL/freeglut.h>" and they run similarly with GLUT and with "freeglut". I have also started work on a programmer's interface specification document.
I need to pause here and let somebody else pick up the ball. I do not have a Linux machine, so I am unable to test any of my changes on a Linux system. On the other hand, I have a fairly large GLUT-based application which I am trying to port to "freeglut", and my customer wants it to run on Windows, Linux, and SGI. And anything else that may come his way as well. So here is my need: I need somebody with a Linux box to run the GLUT demos with "freeglut" and make sure they behave the same (or at least similarly) with both windowing systems. Any help would be appreciated.
Here is a summary of the changes I have made to my private copy of "freeglut":
(1) Many trivial changes (changing floating-point numbers to integers, for example) to reduce the number of compiler warnings
(2) Removing "strlen" calls from for-loop headers to make things execute ever-so-slightly faster
(3) Slight changes to the "glutSolidSphere" and "glutWireSphere" functions to reduce the number of calls to the sine and cosine functions and otherwise make them slightly more efficient
(4) Added wire and solid torus, wire and solid dodecahedron, wire and solid octahedron, wire and solid tetrahedron, and wire and solid icosahedron. Also created a new wire and solid rhombic dodecahedron.
(5) Fixed a bug by which the GLUT menu now draws even when nothing else is happening in the window
(6) Fixed a bug by which freeglut now tracks which window text is being entered into
(7) Added code to adjust for the thickness of the window borders and header bar when resizing and repositioning a window
(8) Added a window destroy callback for freeglut to call the application when a window is closed.
(9) Added the "glutSetOption" function, the "GLUT_ACTION_ON_WINDOW_CLOSE" enumeration, and its allowed values. Implemented the code to allow "freeglut" to continue execution or return control to the calling program if the user clicks on the "x" in the window header.
(10) Added code to check whether a window is a subwindow in the reposition and reshape functions. If it is a subwindow, do not adjust the position and size for the window border.
(11) Added code to fix the drawing of subwindows inside of windows. The Windows implementation uses "GetWindowRect" which uses coordinates relative to the screen corner, not the parent window corner.
(12) Modified the code to open a window so that the freeglut window size and position now matches the GLUT window.
(13) Added an ugly hack to the main loop function to call each window's visibility callback before jumping into the main loop. This fixes the behaviour of several of the demo programs. This should not stay.
(14) Reworked the "freeglut_font.c" file pretty thoroughly to speed things up a bit, to add the "glutStrokeString" function, and to make the "glutStrokeLength" function return an accurate value for long strings. Also allowed the string functions to handle character strings containing carriage returns.
(15) Moved the "fgState" structure initialization in "freeglut_init.c" out of "fgInitialize" to set them at compile time. Also added it to "fgDeinitialize" to reset the state. This allows more flexibility in the order in which the "glutInit*" functions are called.
(16) Recoded a bit in "glutInit" to speed things up slightly
(17) Added "#pragma warning ( once: 4305 )" directives to the stroke font files so that I don't get 4000 compiler warnings about assigning double precision constants to single precision variables
(18) Added a state enumeration (initializing, running, stopping) and flag to the "fgState" structure. Modified the window closure and main loop code to use the enumeration instead of local variables.
(19) Fixed the "glutPositionWindow" so that if you get and retrieve the window position twenty times in a row the window won't slide down the screen.
(20) Recoded the "glut*Cone" functions so that they have normals on the curved surface and so that the "base" argument is really the radius of the base of the cone.
(21) Started work on a "glutInitDisplayString" function. I have provided a framework; I will need some serious help in interpreting the results.
(22) Modified the "fgDisplayMenu" so that the matrix mode is GL_MODELVIEW instead of GL_PROJECTION when execution returns to its calling function. I have no idea why, but this fixes some display problems in some of the demos. Part (or all) of the display was blanking out when the user brought up a menu.
(23) Added four "pragma comment" lines to "freeglut.h" so that freeglut will automatically (under Windows) include "winmm.lib", "opengl32.lib", "glu32.lib", and "freeglut.lib". This way the application doesn't have to do this by hand.
(24) Fixed the window positioning code so that if the border is going to extend above the top of the screen, it gets set to the top of the screen.
(25) Added right-arrows to menu entries which have submenus. Also modified the submenu position so that it comes down to the right or to the left of the parent menu.
(26) Recoded a good bit of the menu processing to make the menus behave more like GLUT menus.
And here are the remaining issues that I have not addressed so far:
(1) In the Atlantis demo, if you stop the animation and move the mouse around with a menu open, the whales jiggle but don't circulate. My guess is that you need a way to redisplay the menu without forcing a redisplay from the application.
(2) In the Atlantis demo, if you bring up the menu in GLUT the animation stops; in freeglut the animation continues. This may be another manifestation of (1).
(3) In the Atlantis demo modified to draw a solid torus instead of a mother whale, the torus is not shaded according to the lighting. This is true with both GLUT and freeglut. With freeglut, when you bring up a menu the shading turns on; with GLUT it does not.
(4) There are several thousand compiler warnings.
(5) With the "bluepony" demo, if you reshape the window using the mouse, the scene does not redraw until you move it with a keypress (arrow key or space bar to start the animation).
(6) The initial call to the visibility function in "glutMainLoop" is an ugly hack and needs to be fixed properly.
(7) If you compare the "bounce" demo with freeglut and GLUT, you see that the slider widths are still slightly off.
(8) We need a way for the application to tell GLUT that it has finished so that it doesn't have to call "exit" from within a callback.
(9) We seem to have troubles with programs that use display lists. Check out the "walker" demo and load a new curve set. If you have the debugger going while it is loading, you get the new curves; otherwise you don't. This has to do with the debugger hiding the freeglut window while the display list is being changed.
John F. Fay