Type, API. License · X Consortium. Website, FreeGLUT is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. These kept the API (all gluts functions are usually implemented exactly with the Two of the most common GLUT replacements are OpenGLUT and freeGLUT. It looks to me that Ubuntu has provided everything that the original web site http:// has provided. The api documentation.
|Published (Last):||17 March 2009|
|PDF File Size:||6.87 Mb|
|ePub File Size:||9.44 Mb|
|Price:||Free* [*Free Regsitration Required]|
Spaceball is a registered aapi of Spatial Systems Inc. The authors have taken care in preparation of this documentation but make no expressed or implied warranty of any kind and assumes no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising from the use of information or programs contained herein. The OpenGL freelut world owes a tremendous debt to Mr. The GLUT library of functions allows an application programmer to create, control, and manipulate windows independent of what operating system the program is running on.
By hiding the dependency on the operating system from the application programmer, he allowed people to write truly portable OpenGL applications.
c++ – Recommended OpenGL / GLUT Reference – Stack Overflow
Kilgard copyrighted his library and gave it a rather unusual license. Under his license, people are allowed freely to copy and distribute the libraries and the source code, but they are not allowed to modify it.
Kilgard was releasing updates on a regular basis.
But with the passage of time, people started wanting some slightly different behaviours in their windowing system. Kilgard stopped supporting the GLUT library inhaving moved on to bigger and better things, this started to become a problem. In DecemberMr.
This open-source zpi, which does not use any of the GLUT source code, has evolved into the present freeglut library. This documentation specifies the application program interface to the freeglut library. In developing the freeglut library, we have taken careful steps to ensure consistency in function operation across the board, in such a manner as to maintain compatibility with GLUT’s behavior whenever possible.
There is freeglu confusion about the “right thing to do” concerning window size and position. When you create a window with position x,y freegput size w,hthe upper left hand corner of the outside of the window the non-client area is at x,y and the size of the drawable client area is w,h.
The coordinates taken by glutInitPosition and glutPositionWindowas well as the coordinates provided by FreeGLUT when it calls the glutPositionFunc callback, specify the top-left of the non-client area of the window.
When you query the size and position of the window using glutGetFreeGLUT will return the size of the drawable area–the w,h that you specified when you created the window–and the coordinates of the upper left hand corner of the drawable client area–which is NOT the x,y position of the window you specified when you created it.
Since the freeglut library apu developed in order to update GLUT, it is natural that there will be some differences between the two. The important ones are summarized here. One of the commonest complaints about the GLUT library was that once an application called glutMainLoopit never got control back. There was no way for an application to loop in GLUT for a while, possibly as a subloop while a specific window was open, and then return freegltu the calling function.
A new function, glutMainLoopEventhas been added to allow this functionality. Another function, glutLeaveMainLoophas also been added to allow the application to tell freeglut to clean up and close down. Another difficulty with GLUT, especially with multiple-window programs, is that if the user clicks on the “x” in the window header the application exits immediately. Function to leave fullscreen window mode, glutLeaveFullScreenor to toggle between fullscreen and normal window mode, glutFullScreenTogglehave been added.
Several new callbacks have been added and several callbacks which were specific to Silicon Graphics hardware have not been implemented. The new callbacks consist of regular and special key release callbacks, a joystick callback, a menu state callback with one argument, distinct from the menu status callback which has three argumentsfreevlut window status callback also with one argumentand a window position callback.
Unsupported callbacks are the two Tablet callbacks. If the user has a need for an unsupported callback he should contact the freeglut development team. New functions have been added to render full character strings including carriage returns rather than rendering one character at a time. More functions return the widths of character strings and the font heights, in pixels for bitmapped fonts and in OpenGL units for the stroke fonts.
Two functions have been added to render a wireframe and a solid rhombic dodecahedron. Furthermore, solid and wireframe versions of the original teacup and teaspoon that accompanied the famous Newell teapot.
Lastly, to support drawing these objects with shaders, three functions have been added with which users can provide the addresses of the Coordinate, Normal and Texture Coordinate vertex attribs: Texture coordinates are only generated for the teaset. The glutInitWindowPosition and glutInitWindowSize functions specify a desired position and size for windows that freeglut will create in the future. The position is measured in pixels from the upper left hand corner of the screen, with “x” increasing to the right and “y” increasing towards the bottom of the screen.
The size is measured in pixels. Freeglut does not promise to follow these specifications in creating freeglut windows, but it certainly makes an attempt to.
The position and size of a window are a matter of some subtlety. Most windows have a usable area surrounded by a border and with a title bar on the top. The border and title bar are commonly called “decorations. On both Linux and Windows, you specify the coordinates of the upper left-hand corner of the window’s decorations. Also for both operating systems, the size of the window is the size of the usable interior.
With glutGet information can be acquired about the current window’s size, position and decorations. Note however that according to FreeGLUT’s conventionsthe information returned about the window coordinates does not correspond to the coordinates used when setting window position. Windows has some additional quirks which the application programmer should know about. First, the minimum y-coordinate of a window decoration is zero. This is a feature of freeglut and can be adjusted if so desired.
Second, there appears to be a minimum window width on Windows which is pixels. The user may specify a smaller width, but the Windows system calls ignore it. It is also impossible to make a window narrower than this by dragging on its corner.
For some reason, GLUT is not affected by the pixel minimum window width. If the user clicks on the corner of a window which is narrower than this amount, the window will immediately snap out to this width, but the application can call glutReshapeWindow and make a window narrower again.
Any spec comparator and value after the token is ignored.
However, many of these values can be set with glutSetOption for now Useful for rerouting to another output sink e. The users callback is passed a format string and a variable argument list that can be passed to functions such as printf. If defined at library not client app! If not defined, warnings and errors are muted not printed to stderrthough errors still trigger deinitialization and exit.
After an application has finished initializing its windows and menus, it enters an event loop. Within this loop, freeglut polls the data entry devices keyboard, mouse, etc. This prevented an application from having re-entrant code, in which GLUT could be invoked from within a callback, and it prevented the application from doing any post-processing such as freeing allocated memory after GLUT had closed down.
Freeglut allows the application programmer to specify more direct control over the event loop by means of two new functions. The first, glutMainLoopEventprocesses a single iteration of the event loop and allows the application to use a different event loop controller or to contain re-entrant code.
The second, glutLeaveMainLoopcauses the event loop to exit nicely; this is preferable to the application’s calling exit from within a GLUT callback. The glutMainLoop function causes the program to enter the window event loop. An application should call this function at most once. It will call any application callback functions as required to process mouse clicks, mouse motion, key presses, and so on.
In GLUT, there was absolutely no way for the application programmer to have control return from the glutMainLoop function to the calling function. Stopping the program this way is preferable to simply calling exit from within a callback because this allows freeglut to free allocated memory and otherwise clean up after itself. I know I just said this, but I think it is important enough that it bears repeating. The glutMainLoopEvent function processes a single iteration in the freeglut event loop.
The glutMainLoopEvent function causes freeglut to process one iteration’s worth of events in its event loop. This allows the application to control its own event loop and still use the freeglut windowing system. The glutLeaveMainLoop function causes freeglut to stop the event loop. If the application has two nested calls to glutMainLoop and calls glutLeaveMainLoopthe behaviour of freeglut is undefined.
It may leave only the inner nested loop or it may leave both loops. If the reader has a strong preference for one behaviour over the other he should contact the freeglut Programming Consortium and ask for the code to be fixed. The glutSetWindowTitleglutSetIconTitle set the window title for when the window is in a visible state and when it is in an iconified state respectively.
Normally a window system displays a title for every top-level window in the system. The initial title is set when you call glutCreateWindow. If you just want one title for the window over the window’s entire life, you should set it when you open the window with glutCreateWindow. The glutFullScreenglutLeaveFullScreen and glutFullScreenToggle functions are used to transition the current window between fullscreen and normal mode.
The glutFullScreen function causes the current window to enter fullscreen mode, glutLeaveFullScreen to go back to the window size and position as it was before entering fullscreen mode, and glutFullScreenToggle toggles between fullscreen and normal mode.
In multi-monitor setups on Windows and newer, the window will become fullscreen on the monitor that it overlaps the most.
GLUT and FreeGLUT
Calls to these functions are ignored for gamemode and child windows. Freeglut does not allow overlays, although it does “answer the mail” with function stubs so that GLUT-based programs can compile and link against freeglut without modification.
If the reader needs overlays, freegult should contact the freegluf Programming Consortium and ask for them to be implemented. He should also be prepared to assist in the implementation. The glutShowOverlay and glutHideOverlay functions are not implemented in freeglut. A warning is issued and the request is ignored if the supplied font is a stroke font, or an unknown font.
The glutIdleFunc function sets the global idle callback. Freeglut calls the idle callback when there are no inputs from the user.
The glutIdleFunc function specifies the function that freeglut will call to perform background processing tasks such as continuous animation when window system events are not being received.
If enabled, this function is called freeglut from freeglut while no events are received. The callback function has no parameters and returns no value.