From bec227f153f60b8a314bd7defddd5e549b72bfa0 Mon Sep 17 00:00:00 2001 From: Eric Sandall Date: Wed, 18 Jun 2003 22:26:50 +0000 Subject: [PATCH] * Hopefully I did THIS one right (used 'cvs update' to Merge) Authors - The first update in quite a while ChangeLog - Added the recent changes freeglut_callbacks.c - Added Aleksandar Donev's menu destruction callback freeglut_internal.h - Added the user data to the structures and made the menu state/status callbacks window-independent freeglut_menu.c - Removed several OpenGL compiler warnings and added A. Donev's menu user data functions freeglut_structure.c - Added Aleksandar Donev's menu destruction callback freeglut_teapot.c - Removed or suppressed several compiler warnings freeglut_window.c - Updated the window positioning code and added A. Donev's window user data freeglut_ext.h - Added the menu destruction callback and user data functions git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@79 7f0cb862-5218-0410-a997-914c9d46530a --- ChangeLog | 18 +- doc/freeglut_user_interface.html | 3312 ++++++++++++++++++++----------------- freeglut-1.3/freeglut_callbacks.c | 7 + freeglut-1.3/freeglut_ext.c | 7 +- freeglut-1.3/freeglut_internal.h | 14 +- freeglut-1.3/freeglut_menu.c | 43 +- freeglut-1.3/freeglut_structure.c | 13 + freeglut-1.3/freeglut_teapot.c | 6 +- freeglut-1.3/freeglut_window.c | 35 +- include/GL/freeglut_ext.h | 13 +- 10 files changed, 1922 insertions(+), 1546 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0835f0f..6d78d68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -136,24 +136,26 @@ October 24, 2002: (51) Changed "freeglut_state.c" so the "glutGet" calls with window position and size don't move the windows down and to the right one pixel. -******************************************************************************************* -* Changes starting in May 2003 -******************************************************************************************* - (52) Implement single-buffered rendering (or its emulation) in Windows. (53) Implement Eero Pajarre's "GLUT_ICON" code. (54) Fixes for the window positioning problem. -(55) Fixed a couple of compiler warnings and other bugs. Changed "freeglut_main.c" to remove a compiler warning. Changed "freeglut_structure.c" to set the current window before calling the window closure callback. +(55) Fixed a couple of compiler warnings and other bugs. Changed "freeglut_main.c" to remove a compiler warning. Changed "freeglut_structure.c" to set the current window before calling the window closure callback. ******************************************************************************************* -* Changes on 17 June 2003 +* Changes on 17-19 June 2003 ******************************************************************************************* -(56) Added glutGetProcAddress() +(56) Added glutGetProcAddress() + +(57) Added GLUT_FPS env var. + +(58) Implemented Aleksandar Donev's user data changes: added user data fields to window and menu structures and implemented functions to get and set them + +(59) Added a "MenuDestroy" callback which sets a function that "freeglut" calls when a menu is destroyed. + -(57) Added GLUT_FPS env var. diff --git a/doc/freeglut_user_interface.html b/doc/freeglut_user_interface.html index 3785559..6a63382 100644 --- a/doc/freeglut_user_interface.html +++ b/doc/freeglut_user_interface.html @@ -1,1507 +1,1843 @@ - + - - - - FREEGLUT Application Program Interface + + + + + + + FREEGLUT Application Program Interface - - + +
-
-

-The Open-Source

- -
-

-OpenGL Utility Toolkit

- -
-

-(freeglut)

- -
-

-Application Programming Interface

+
+

The Open-Source

+
+
+

OpenGL Utility Toolkit

+
+
+

(freeglut)

+
+
+

Application Programming Interface

+
- -
-

-Version 4.0

- -
-

-The freeglut Programming Consortium

- -
-

-November, 2002

- -


OpenGL is a trademark of Silicon Graphics, Inc. X Window System -is a trademark of X Consortium, Inc.  Spaceball is a registered trademark -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. -
  -

-1.0  Contents

-1.0  Contents + +
+

Version 4.0

+
+ +
+

The freeglut Programming Consortium

+
+ +
+

November, 2002

+
+ +


+ OpenGL is a trademark of Silicon Graphics, Inc. X Window System is a trademark +of X Consortium, Inc.  Spaceball is a registered trademark 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.
+  

+ +

1.0  + Contents

+ 1.0  Contents +

2.0  Introduction +

+

3.0  Background -

3.1  Design Philosophy -
3.2  Conventions -
3.3  Terminology -
3.4  Differences from GLUT 3.7
- -


4.0  Initialization Functions -

4.1  glutInit -
4.2  glutInitWindowPosition, glutInitWindowSize -
4.3  glutInitDisplayMode -
4.4  glutInitDisplayString
- -


5.0  Event Processing Functions -

5.1  glutMainLoop -
5.2  glutMainLoopEvent -
5.3  glutLeaveMainLoop
- -


6.0  Window Functions -

6.1  glutCreateWindow -
6.2  glutCreateSubwindow -
6.3  glutDestroyWindow -
6.4  glutSetWindow, glutGetWindow -
6.5  glutSetWindowTitle, glutSetIconTitle -
6.6  glutReshapeWindow -
6.7  glutPositionWindow -
6.8  glutShowWindow, glutHideWindow, glutIconifyWindow -
6.9  glutPushWindow, glutPopWindow -
6.10  glutFullScreen
- -


7.0  Display Functions -

7.1  glutPostRedisplay -
7.2  glutPostWindowRedisplay -
7.3  glutSwapBuffers
- -


8.0  Mouse Cursor Functions -

8.1  glutSetCursor -
8.2  glutWarpPointer
- -


9.0  Overlay Functions -

9.1  glutEstablishOverlay -
9.2  glutRemoveOverlay -
9.3  glutUseLayer -
9.4  glutPostOverlayRedisplay -
9.5  glutPostWindowOverlayRedisplay -
9.6  glutShowOverlay, glutHideOverlay
- -


10.0  Menu Functions -

10.1  glutCreateMenu -
10.2  glutDestroyMenu -
10.3  glutGetMenu, glutSetMenu -
10.4  glutAddMenuEntry -
10.5  glutAddSubMenu -
10.6  glutChangeToMenuEntry -
10.7  glutChangeToSubMenu -
10.8  glutRemoveMenuItem -
10.9  glutAttachMenu, glutDetachMenu
- -


11.0  Global Callback Registration -Functions -

11.1  glutTimerFunc -
11.2  glutIdleFunc
- -


12.0  Window-Specific Callback Registration -Functions -

12.1  glutDisplayFunc -
12.2  glutOverlayDisplayFunc -
12.3  glutReshapeFunc -
12.4  glutCloseFunc -
12.5  glutKeyboardFunc -
12.6  glutSpecialFunc -
12.7  glutKeyboardUpFunc -
12.8  glutSpecialUpFunc -
12.9  glutMouseFunc -
12.10  glutMotionFunc, glutPassiveMotionFunc -
12.11  glutVisibilityFunc -
12.12  glutEntryFunc -
12.13  glutJoystickFunc -
12.14  glutSpaceballMotionFunc -
12.15  glutSpaceballRotateFunc -
12.16  glutSpaceballButtonFunc -
12.17  glutButtonBoxFunc -
12.18  glutDialsFunc -
12.19  glutTabletMotionFunc -
12.20  glutTabletButtonFunc -

12.21  glutMenuStatusFunc -
12.22  glutWindowStatusFunc

- -


13.0  State Setting and Retrieval Functions -

13.1  glutSetOption -
13.2  glutGet -
13.3  glutDeviceGet -
13.4  glutGetModifiers -
13.5  glutLayerGet -
13.6  glutExtensionSupported -
13.7  glutGetProcAddress
- -


14.0  Font Rendering Functions -

14.1  glutBitmapCharacter -
14.2  glutBitmapString -
14.3  glutBitmapWidth -
14.4  glutBitmapLength -
14.5  glutBitmapHeight -
14.6  glutStrokeCharacter -
14.7  glutStrokeString -
14.8  glutStrokeWidth -
14.9  glutStrokeLength -
14.10  glutStrokeHeight
- -


15.0  Geometric Object Rendering -Functions -

15.1  glutWireSphere, glutSolidSphere -
15.2  glutWireTorus, glutSolidTorus -
15.3  glutWireCone, glutSolidCone -
15.4  glutWireCube, glutSolidCube -
15.5  glutWireTetrahedron, glutSolidTetrahedron -
15.6  glutWireOctahedron, glutSolidOctahedron -
15.7  glutWireDodecahedron, glutSolidDodecahedron -
15.8  glutWireIcosahedron, glutSolidIcosahedron -
15.9  glutWireRhombicDodecahedron, glutSolidRhombicDodecahedron -
15.10  glutWireTeapot, glutSolidTeapot
- -


16.0  Game Mode Functions -

16.1  glutGameModeString -
16.2  glutEnterGameMode, glutLeaveGameMode -
16.3  glutGameModeGet
- -


17.0  Video Resize Functions -

17.1  glutVideoResizeGet -
17.2  glutSetupVideoResizing, glutStopVideoResizing -
17.3  glutVideoResize -
17.4  glutVideoPan
- -


18.0  Color Map Functions -

18.1  glutSetColor, glutGetColor -
18.2  glutCopyColormap
- -


19.0  Miscellaneous Functions -

19.1  glutIgnoreKeyRepeat, glutSetKeyRepeat -
19.2  glutForceJoystickFunc -
19.3  glutReportErrors
- -


20.0  Usage Notes -

21.0  Implementation Notes -

22.0  GLUT State -

23.0  "freeglut.h" Header File -

24.0  References -

25.0  Index -
  -
  -

-2.0  Introduction

-  -

-3.0  Background

-The OpenGL programming world owes a tremendous debt to Mr. Mark J. Kilgard -for writing the OpenGL Utility Toolkit, or GLUT.  The GLUT library +

+ +
3.1  Design Philosophy
+ 3.2  Conventions
+ 3.3  Terminology
+ 3.4  Differences from GLUT 3.7
+ +


+ 4.0  Initialization Functions +

+ +
4.1  glutInit
+ 4.2  glutInitWindowPosition, glutInitWindowSize
+ 4.3  glutInitDisplayMode
+ 4.4  glutInitDisplayString
+ +


+ 5.0  Event Processing Functions +

+ +
5.1  glutMainLoop
+ 5.2  glutMainLoopEvent
+ 5.3  glutLeaveMainLoop
+ +


+ 6.0  Window Functions +

+ +
6.1  glutCreateWindow
+ 6.2  glutCreateSubwindow
+ 6.3  glutDestroyWindow
+ 6.4  glutSetWindow, glutGetWindow
+ 6.5  glutSetWindowTitle, glutSetIconTitle
+ 6.6  glutReshapeWindow
+ 6.7  glutPositionWindow
+ 6.8  glutShowWindow, glutHideWindow, glutIconifyWindow
+ 6.9  glutPushWindow, glutPopWindow
+ 6.10  glutFullScreen
+ +


+ 7.0  Display Functions +

+ +
7.1  glutPostRedisplay
+ 7.2  glutPostWindowRedisplay
+ 7.3  glutSwapBuffers
+ +


+ 8.0  Mouse Cursor Functions +

+ +
8.1  glutSetCursor
+ 8.2  glutWarpPointer
+ +


+ 9.0  Overlay Functions +

+ +
9.1  glutEstablishOverlay
+ 9.2  glutRemoveOverlay
+ 9.3  glutUseLayer
+ 9.4  glutPostOverlayRedisplay
+ 9.5  glutPostWindowOverlayRedisplay
+ 9.6  glutShowOverlay, glutHideOverlay
+ +


+ 10.0  Menu Functions +

+ +
10.1  glutCreateMenu
+ 10.2  glutDestroyMenu
+ 10.3  glutGetMenu, glutSetMenu
+ 10.4  glutAddMenuEntry
+ 10.5  glutAddSubMenu
+ 10.6  glutChangeToMenuEntry
+ 10.7  glutChangeToSubMenu
+ 10.8  glutRemoveMenuItem
+ 10.9  glutAttachMenu, glutDetachMenu
+ +


+ 11.0  Global Callback Registration Functions +

+ +
11.1  glutTimerFunc
+ 11.2  glutIdleFunc
+ +


+ 12.0  Window-Specific Callback Registration + Functions +

+ +
12.1  glutDisplayFunc
+ 12.2  glutOverlayDisplayFunc
+ 12.3  glutReshapeFunc
+ 12.4  glutCloseFunc
+ 12.5  glutKeyboardFunc
+ 12.6  glutSpecialFunc
+ 12.7  glutKeyboardUpFunc
+ 12.8  glutSpecialUpFunc
+ 12.9  glutMouseFunc
+ 12.10  glutMotionFunc, glutPassiveMotionFunc
+ 12.11  glutVisibilityFunc
+ 12.12  glutEntryFunc
+ 12.13  glutJoystickFunc
+ 12.14  glutSpaceballMotionFunc
+ 12.15  glutSpaceballRotateFunc
+ 12.16  glutSpaceballButtonFunc
+ 12.17  glutButtonBoxFunc
+ 12.18  glutDialsFunc
+ 12.19  glutTabletMotionFunc
+ 12.20  glutTabletButtonFunc +

12.21  glutMenuStatusFunc
+ 12.22  glutWindowStatusFunc

+
+ +


+ 13.0  State Setting and Retrieval Functions +

+ +
13.1  glutSetOption
+ 13.2  glutGet
+ 13.3  glutDeviceGet
+ 13.4  glutGetModifiers
+ 13.5  glutLayerGet
+ 13.6  glutExtensionSupported
+13.7  glutGetProcAddress
+
+ +


+ 14.0  Font Rendering Functions +

+ +
14.1  glutBitmapCharacter
+ 14.2  glutBitmapString
+ 14.3  glutBitmapWidth
+ 14.4  glutBitmapLength
+ 14.5  glutBitmapHeight
+ 14.6  glutStrokeCharacter
+ 14.7  glutStrokeString
+ 14.8  glutStrokeWidth
+ 14.9  glutStrokeLength
+ 14.10  glutStrokeHeight
+ +


+ 15.0  Geometric Object Rendering Functions +

+ +
15.1  glutWireSphere, glutSolidSphere +
+ 15.2  glutWireTorus, glutSolidTorus
+ 15.3  glutWireCone, glutSolidCone
+ 15.4  glutWireCube, glutSolidCube
+ 15.5  glutWireTetrahedron, glutSolidTetrahedron
+ 15.6  glutWireOctahedron, glutSolidOctahedron
+ 15.7  glutWireDodecahedron, glutSolidDodecahedron
+ 15.8  glutWireIcosahedron, glutSolidIcosahedron
+ 15.9  glutWireRhombicDodecahedron, glutSolidRhombicDodecahedron
+ 15.10  glutWireTeapot, glutSolidTeapot
+ +


+ 16.0  Game Mode Functions +

+ +
16.1  glutGameModeString
+ 16.2  glutEnterGameMode, glutLeaveGameMode
+ 16.3  glutGameModeGet
+ +


+ 17.0  Video Resize Functions +

+ +
17.1  glutVideoResizeGet
+ 17.2  glutSetupVideoResizing, glutStopVideoResizing
+ 17.3  glutVideoResize
+ 17.4  glutVideoPan
+ +


+ 18.0  Color Map Functions +

+ +
18.1  glutSetColor, glutGetColor +
+ 18.2  glutCopyColormap
+ +


+ 19.0  Miscellaneous Functions +

+ +
19.1  glutIgnoreKeyRepeat, +glutSetKeyRepeat
+ 19.2  glutForceJoystickFunc
+ 19.3  glutReportErrors
+ +


+ 20.0  Usage Notes +

+ +

21.0  + Implementation Notes +

+ +

22.0  GLUT +State +

+ +

23.0  + "freeglut.h" Header File +

+ +

24.0  References +

+ +

25.0  Index +
+  
+  

+ +

2.0  + Introduction

+   +

3.0  + Background

+ The OpenGL programming world owes a tremendous debt to Mr. Mark J. Kilgard + for writing the OpenGL Utility Toolkit, or GLUT.  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. -

    Mr. 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.  For a long time this did not matter because -the GLUT library worked so well and because Mr. 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.  -When Mr. Kilgard stopped supporting the GLUT library in 1999, having moved -on to bigger and better things, this started to become a problem. -

    In December 1999, Mr. Pawel Olzsta started work on -an open-source clone of the GLUT library.  This open-source clone, -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. -

-3.1  Design Philosophy

- -

-3.2  Conventions

- -

-3.3  Terminology

- -

-3.4  Differences from GLUT 3.7

-Since the freeglut library was developed in order to update GLUT, -it is natural that there will be some differences between the two.  -Each function in the API notes any differences between the GLUT and the -freeglut -function behaviours.  The important ones are summarized here. -

-3.4.1  glutMainLoop Behaviour

-One of the commonest complaints about the GLUT library was that once an + 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. + +

    Mr. 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.  For a long time this did +not matter because the GLUT library worked so well and because Mr. 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.  When Mr. Kilgard stopped supporting the GLUT library in 1999, +having moved on to bigger and better things, this started to become a problem. +

+ +

    In December 1999, +Mr. Pawel Olzsta started work on an open-source clone of the GLUT library.  +This open-source clone, 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. +

+ +

3.1  Design Philosophy

+ +

3.2  Conventions

+ +

3.3  Terminology

+ +

3.4  Differences from GLUT 3.7

+ Since the freeglut library was developed in order to update GLUT, + it is natural that there will be some differences between the two.  +Each function in the API notes any differences between the GLUT and the +freeglut function behaviours.  The important ones are summarized +here. +

3.4.1  glutMainLoop Behaviour

+ One of the commonest complaints about the GLUT library was that once an application called "glutMainLoop", it 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 to the calling -function.  A new function, "glutMainLoopEvent", has been -added to allow this functionality.  Another function, "glutLeaveMainLoop", -has also been added to allow the application to tell freeglut to clean -up and close down. -

-3.4.2  Action on Window Closure

-Another difficulty with GLUT, especially with multiple-window programs, +function.  A new function, "glutMainLoopEvent", has been added +to allow this functionality.  Another function, "glutLeaveMainLoop +", has also been added to allow the application to tell freeglut to clean +up and close down. +

3.4.2  Action on Window Closure

+ 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.  The application programmer can now set an option, " GLUT_ACTION_ON_WINDOW_CLOSE", to specify whether execution should continue, whether GLUT should return control to the main program, or whether -GLUT should simply exit (the default). -

-3.4.3  String Rendering

-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. -

-3.4.4  Geometry Rendering

-Two functions have been added to render a wireframe and a solid rhombic -dodecahedron. -

-3.4.5  Extension Function Queries

-glutGetProcAddress is a wrapper for the glXGetProcAddressARB and -wglGetProcAddress functions. -

- - - - -4.0  Initialization Functions

- -

-4.1  glutInit

- -

-4.2  glutInitWindowPosition, glutInitWindowSize

-The "glutInitWindowPosition " and "glutInitWindowSize" -functions specify a desired position and size for windows that freeglut -will create in the future. -

Usage -

void glutInitWindowPosition ( int x, int y ) ; -
void glutInitWindowSize ( int width, int height ) ; -

Description -

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 its windows, 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."  -The position of the window unfortunately varies with the operating system.  -On Linux, it is the coordinates of the upper left-hand corner of its decorations.  -On Windows, it is the coordinates of the upper left hand corner of its -usable interior.  For both operating systems, the size of the window -is the size of the usable interior. -

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 104 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. -

Changes From GLUT -

For some reason, GLUT is not affected by the 104-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. -

-4.3  glutInitDisplayMode

- -

-4.4  glutInitDisplayString

- -

-5.0  Event Processing Functions

-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.) and calls the application's -appropriate callbacks. -

In GLUT, control never returned from the event loop (as invoked by the -"glutMainLoop" function) to the calling function.  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, "glutMainLoopEvent", processes 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, "glutLeaveMainLoop", -causes the event loop to exit nicely; this is preferable to the application's -calling "exit" from within a GLUT callback. -

-5.1  glutMainLoop

-The "glutMainLoop" function enters the event loop. -

Usage -

void glutMainLoop ( void ) ; -

Description -

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. -

Changes From GLUT -

In GLUT, there was absolutely no way for the application programmer -to have control return from the "glutMainLoop " function to the -calling function.  Freeglut allows the programmer to force -this by setting the "GLUT_ACTION_ON_WINDOW_CLOSE" option and invoking -the "glutLeaveMainLoop" function from one of the callbacks.  -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.) -

-5.2  glutMainLoopEvent

-The "glutMainLoopEvent" function processes a single iteration -in the freeglut event loop. -

Usage -

void glutMainLoopEvent ( void ) ; -

Description -

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. -

Changes From GLUT -

GLUT does not include this function. -

-5.3  glutLeaveMainLoop

-The "glutLeaveMainLoop" function causes freeglut to stop -its event loop. -

Usage -

void glutLeaveMainLoop ( void ) ; -

Description -

The  "glutLeaveMainLoop " function causes freeglut -to stop the event loop.  If the " GLUT_ACTION_ON_WINDOW_CLOSE" -option has been set to "GLUT_ACTION_CONTINUE_EXECUTION ", control -will return to the function which called "glutMainLoop "; otherwise -the application will exit. -

If the application has two nested calls to "glutMainLoop" and -calls "glutLeaveMainLoop", the 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. -

Changes From GLUT -

GLUT does not include this function. -

-6.0  Window Functions

- -

-6.1  glutCreateWindow

- -

-6.2  glutCreateSubwindow

- -

-6.3  glutDestroyWindow

- -

-6.4  glutSetWindow, glutGetWindow

- -

-6.5  glutSetWindowTitle, glutSetIconTitle

- -

-6.6  glutReshapeWindow

- -

-6.7  glutPositionWindow

- -

-6.8  glutShowWindow, glutHideWindow, glutIconifyWindow

- -

-6.9  glutPushWindow, glutPopWindow

- -

-6.10  glutFullScreen

- -

-7.0  Display Functions

- -

-7.1  glutPostRedisplay

- -

-7.2  glutPostWindowRedisplay

- -

-7.3  glutSwapBuffers

- -

-8.0  Mouse Cursor Functions

- -

-8.1  glutSetCursor

- -

-8.2  glutWarpPointer

- -

-9.0  Overlay Functions

-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, he should contact -the freeglut Programming Consortium and ask for them to be implemented.  -He should also be prepared to assist in the implementation. -

-9.1  glutEstablishOverlay

-The "glutEstablishOverlay" function is not implemented in freeglut. -

Usage -

void glutEstablishOverlay ( void ) ; -

Description -

The "glutEstablishOverlay" function is not implemented in freeglut. -

Changes From GLUT -

GLUT implements this function. -

-9.2  glutRemoveOverlay

-The "glutRemoveOverlay" function is not implemented in freeglut. -

Usage -

void glutRemoveOverlay ( void ) ; -

Description -

The "glutRemoveOverlay" function is not implemented in freeglut. -

Changes From GLUT -

GLUT implements this function. -

-9.3  glutUseLayer

-The "glutUseLayer" function is not implemented in freeglut. -

Usage -

void glutUseLayer (  GLenum layer ) ; -

Description -

The "glutUseLayer" function is not implemented in freeglut. -

Changes From GLUT -

GLUT implements this function. -

-9.4  glutPostOverlayRedisplay

-The "glutPostOverlayRedisplay " function is not implemented in -freeglut. -

Usage -

void glutPostOverlayRedisplay ( void ) ; -

Description -

The "glutPostOverlayRedisplay " function is not implemented -in freeglut. -

Changes From GLUT -

GLUT implements this function. -

-9.5  glutPostWindowOverlayRedisplay

-The "glutPostWindowOverlayRedisplay " function is not implemented -in freeglut. -

Usage -

void glutPostWindowOverlayRedisplay ( int window ) ; -

Description -

The "glutPostWindowOverlayRedisplay " function is not implemented -in freeglut. -

Changes From GLUT -

GLUT implements this function. -

-9.6  glutShowOverlay, glutHideOverlay

-The "glutShowOverlay" and "glutHideOverlay" functions -are not implemented in freeglut . -

Usage -

void glutShowOverlay( void ) ; -
void glutHideOverlay( void ) ; -

Description -

The "glutShowOverlay" and "glutHideOverlay" functions -are not implemented in freeglut . -

Changes From GLUT -

GLUT implements these functions. -

-10.0  Menu Functions

- -

-10.1  glutCreateMenu

- -

-10.2  glutDestroyMenu

- -

-10.3  glutGetMenu, glutSetMenu

- -

-10.4  glutAddMenuEntry

- -

-10.5  glutAddSubMenu

- -

-10.6  glutChangeToMenuEntry

- -

-10.7  glutChangeToSubMenu

- -

-10.8  glutRemoveMenuItem

- -

-10.9  glutAttachMenu, glutDetachMenu

- -

-11.0  Global Callback Registration Functions

- -

-11.1  glutTimerFunc

- -

-11.2  glutIdleFunc

-The "glutIdleFunc" function sets the global idle callback. Freeglut -calls the idle callback when there are no inputs from the user. -

Usage -

void glutIdleFunc ( void (*func) ( void ) ) ; -

func    The new global idle callback function -

Description -

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 continuously from freeglut while no events are -received.  The callback function has no parameters and returns no -value.  Freeglut does not change the current window -or the current menu before invoking the idle callback; programs -with multiple windows or menus must explicitly set the current window -and current menu and not rely on its current setting. -
    The amount of computation and rendering done in -an idle callback should be minimized to avoid affecting the program's interactive -response.  In general, no more than a single frame of rendering should -be done in a single invocation of an idle callback. -
    Calling "glutIdleFunc" with a NULL argument -disables the call to an idle callback. -

Changes From GLUT -

Application programmers should note that if they have specified the -"continue execution" action on window closure, freeglut will continue -to call the idle callback after the user has closed a window by clicking -on the "x" in the window header bar.  If the idle callback renders -a particular window (this is considered bad form but is frequently done -anyway), the programmer should supply a window closure callback for that -window which changes or disables the idle callback. -

-12.0  Window-Specific Callback Registration -Functions

- -

-12.1  glutDisplayFunc

- -

-12.2  glutOverlayDisplayFunc

- -

-12.3  glutReshapeFunc

- -

-12.4  glutCloseFunc

- -

-12.5  glutKeyboardFunc

- -

-12.6  glutSpecialFunc

-The "glutSpecialFunc" function sets the window's special key press -callback. Freeglut calls the special key press callback when the -user presses a special key. -

Usage -

void glutSpecialFunc ( void (*func) ( int key, int x, int y ) ) -; -

func    The window's new special key press callback -function -
key     The key whose press triggers the -callback -
x       The x-coordinate of -the mouse relative to the window at the time the key is pressed -
y       The y-coordinate of -the mouse relative to the window at the time the key is pressed -

Description -

The  "glutSpecialFunc" function specifies the function -that freeglut will call when the user presses a special key on the -keyboard.  The callback function has one argument:  the name -of the function to be invoked ("called back") at the time at which the -special key is pressed.  The function returns no value.  Freeglut -sets the current window to the window which is active when the callback -is invoked.  "Special keys" are the function keys, the arrow keys, -the Page Up and Page Down keys, and the Insert key.  The Delete key -is considered to be a regular key. -
    Calling "glutSpecialUpFunc" with a NULL -argument disables the call to the window's special key press callback. -

    The "key" argument may take one of the following -defined constant values: -

-Changes From GLUT -

None. -

-12.7  glutKeyboardUpFunc

-The "glutKeyboardUpFunc" function sets the window's key release -callback. Freeglut calls the key release callback when the user -releases a key. -

Usage -

void glutKeyboardUpFunc ( void (*func) ( unsigned char key, int -x, int y ) ) ; -

func    The window's new key release callback -function -
key     The key whose release triggers -the callback -
x       The x-coordinate of -the mouse relative to the window at the time the key is released -
y       The y-coordinate of -the mouse relative to the window at the time the key is released -

Description -

The  "glutKeyboardUpFunc" function specifies the function -that freeglut will call when the user releases a key from the keyboard.  -The callback function has one argument:  the name of the function -to be invoked ("called back") at the time at which the key is released.  -The function returns no value.  Freeglut sets the current -window to the window which is active when the callback is invoked. -
    While freeglut checks for upper or lower -case letters, it does not do so for non-alphabetical characters.  -Nor does it account for the Caps-Lock key being on.  The operating -system may send some unexpected characters to freeglut, such as -"8" when the user is pressing the Shift key.  Freeglut also -invokes the callback when the user releases the Control, Alt, or Shift -keys, among others.  Releasing the Delete key causes this function -to be invoked with a value of 127 for "key". -
    Calling "glutKeyboardUpFunc" with a NULL -argument disables the call to the window's key release callback. -

Changes From GLUT -

This function is not implemented in GLUT versions before Version 4.  -It has been designed to be as close to GLUT as possible.  Users who -find differences should contact the freeglut development team to -have them fixed. -

-12.8  glutSpecialUpFunc

-The "glutSpecialUpFunc" function sets the window's special key +GLUT should simply exit (the default). + +

3.4.3  Changes to Callbacks
+

+ Several new callbacks have been added and several callbacks which were specific +to Silicon Graphics hardware have not been implemented.  Most or all +of the new callbacks are listed in the GLUT Version 4 "glut.h" header file +but did not make it into the documentation.  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 arguments), and a window status callback
+ (also with one argument).  Unsupported callbacks are the three Spaceball +callbacks, the ButtonBox callback, the Dials callback, and the two Tablet +callbacks.  If the user has a need for an unsupported callback he should +contact the freeglut development team.
+ +

3.4.4  String Rendering
+

+ 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.
+ +

3.4.5  Geometry Rendering
+

+ Two functions have been added to render a wireframe and a solid rhombic +dodecahedron. +

3.4.5  Extension Function Queries

+ glutGetProcAddress is a wrapper for the glXGetProcAddressARB and wglGetProcAddress +functions. +

4.0  + Initialization Functions

+ +

4.1  glutInit

+ +

4.2  glutInitWindowPosition, glutInitWindowSize

+ The "glutInitWindowPosition " and "glutInitWindowSize +" functions specify a desired position and size for windows that freeglut + will create in the future. +

Usage

+ +

void glutInitWindowPosition ( int +x, int y ) ;
+ void glutInitWindowSize ( int width, +int height ) ;

+ +

Description

+ +

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 its windows, +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."  The position of the window unfortunately +varies with the operating system.  On Linux, it is the coordinates of +the upper left-hand corner of its decorations.  On Windows, it is the +coordinates of the upper left hand corner of its usable interior.  For +both operating systems, the size of the window is the size of the usable interior. +

+ +

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 104 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. +

+ +

Changes From GLUT

+ +

For some reason, GLUT is not affected +by the 104-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.

+ +

4.3  glutInitDisplayMode

+ +

4.4  glutInitDisplayString

+ +

5.0  + Event Processing Functions

+ 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.) and calls the application's appropriate +callbacks. +

In GLUT, control never returned from +the event loop (as invoked by the "glutMainLoop" function) to the +calling function.  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, "glutMainLoopEvent", processes +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, " +glutLeaveMainLoop", causes the event loop to exit nicely; this is preferable +to the application's calling "exit" from within a GLUT callback. +

+ +

5.1  glutMainLoop

+ The "glutMainLoop" function enters the event loop. + +

Usage

+ +

void glutMainLoop ( void ) ; +

+ +

Description

+ +

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.

+ +

Changes From GLUT

+ +

In GLUT, there was absolutely no way +for the application programmer to have control return from the "glutMainLoop + " function to the calling function.  Freeglut allows the programmer +to force this by setting the "GLUT_ACTION_ON_WINDOW_CLOSE" option +and invoking the "glutLeaveMainLoop" function from one of the callbacks.  + 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.)

+ +

5.2  glutMainLoopEvent

+ The "glutMainLoopEvent" function processes a single iteration +in the freeglut event loop. +

Usage

+ +

void glutMainLoopEvent ( void ) ; +

+ +

Description

+ +

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.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

5.3  glutLeaveMainLoop

+ The "glutLeaveMainLoop" function causes freeglut to stop + its event loop. +

Usage

+ +

void glutLeaveMainLoop ( void ) ; +

+ +

Description

+ +

The  "glutLeaveMainLoop + " function causes freeglut to stop the event loop.  If the +" GLUT_ACTION_ON_WINDOW_CLOSE" option has been set to "GLUT_ACTION_CONTINUE_EXECUTION + ", control will return to the function which called "glutMainLoop + "; otherwise the application will exit.

+ +

If the application has two nested calls +to "glutMainLoop" and calls "glutLeaveMainLoop", the 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.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

6.0  + Window Functions

+ +

6.1  glutCreateWindow

+ +

6.2  glutCreateSubwindow

+ +

6.3  glutDestroyWindow

+ +

6.4  glutSetWindow, glutGetWindow

+ +

6.5  glutSetWindowTitle, glutSetIconTitle

+ +

6.6  glutReshapeWindow

+ +

6.7  glutPositionWindow

+ +

6.8  glutShowWindow, glutHideWindow, +glutIconifyWindow

+ +

6.9  glutPushWindow, glutPopWindow

+ +

6.10  glutFullScreen

+ +

7.0  + Display Functions

+ +

7.1  glutPostRedisplay

+ +

7.2  glutPostWindowRedisplay

+ +

7.3  glutSwapBuffers

+ +

8.0  + Mouse Cursor Functions

+ +

8.1  glutSetCursor

+ +

8.2  glutWarpPointer

+ +

9.0  + Overlay Functions

+ 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, he should contact the freeglut Programming +Consortium and ask for them to be implemented.  He should also be prepared +to assist in the implementation. +

9.1  glutEstablishOverlay

+ The "glutEstablishOverlay" function is not implemented in freeglut + . +

Usage

+ +

void glutEstablishOverlay ( void +) ;

+ +

Description

+ +

The "glutEstablishOverlay" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

9.2  glutRemoveOverlay

+ The "glutRemoveOverlay" function is not implemented in freeglut + . +

Usage

+ +

void glutRemoveOverlay ( void ) ; +

+ +

Description

+ +

The "glutRemoveOverlay" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

9.3  glutUseLayer

+ The "glutUseLayer" function is not implemented in freeglut + . +

Usage

+ +

void glutUseLayer (  GLenum +layer ) ;

+ +

Description

+ +

The "glutUseLayer" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

9.4  glutPostOverlayRedisplay

+ The "glutPostOverlayRedisplay " function is not implemented in + freeglut. + +

Usage

+ +

void glutPostOverlayRedisplay ( void +) ;

+ +

Description

+ +

The "glutPostOverlayRedisplay + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

9.5  glutPostWindowOverlayRedisplay

+ The "glutPostWindowOverlayRedisplay " function is not implemented + in freeglut. +

Usage

+ +

void glutPostWindowOverlayRedisplay +( int window ) ;

+ +

Description

+ +

The "glutPostWindowOverlayRedisplay + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

9.6  glutShowOverlay, glutHideOverlay

+ The "glutShowOverlay" and "glutHideOverlay" functions +are not implemented in freeglut . + +

Usage

+ +

void glutShowOverlay( void ) ; +
+ void glutHideOverlay( void ) ; +

+ +

Description

+ +

The "glutShowOverlay" and " +glutHideOverlay" functions are not implemented in freeglut . +

+ +

Changes From GLUT

+ +

GLUT implements these functions.

+ +

10.0  + Menu Functions

+ +

10.1  glutCreateMenu

+ +

10.2  glutDestroyMenu

+ +

10.3  glutGetMenu, glutSetMenu

+ +

10.4  glutAddMenuEntry

+ +

10.5  glutAddSubMenu

+ +

10.6  glutChangeToMenuEntry

+ +

10.7  glutChangeToSubMenu

+ +

10.8  glutRemoveMenuItem

+ +

10.9  glutAttachMenu, glutDetachMenu

+ +

11.0  + Global Callback Registration Functions

+ +

11.1  glutTimerFunc

+ +

11.2  glutIdleFunc

+ The "glutIdleFunc" function sets the global idle callback. +Freeglut calls the idle callback when there are no inputs from the user. + +

Usage

+ +

void glutIdleFunc ( void (*func) +( void ) ) ;

+ +

func    The new +global idle callback function

+ +

Description

+ +

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 continuously +from freeglut while no events are received.  The callback function +has no parameters and returns no value.  Freeglut does not change +the current window or the current menu before invoking the idle +callback; programs with multiple windows or menus must explicitly set the + current window and current menu + and not rely on its current setting.
+     The amount of computation and rendering done in an idle +callback should be minimized to avoid affecting the program's interactive + response.  In general, no more than a single frame of rendering should + be done in a single invocation of an idle callback.
+     Calling "glutIdleFunc" with a NULL argument +disables the call to an idle callback.

+ +

Changes From GLUT

+ +

Application programmers should note that +if they have specified the "continue execution" action on window closure, + freeglut will continue to call the +idle callback after the user has closed a window by clicking on the "x" in +the window header bar.  If the idle callback renders a particular window +(this is considered bad form but is frequently done anyway), the programmer +should supply a window closure callback for that window which changes or disables +the idle callback.

+ +

12.0  + Window-Specific Callback Registration Functions

+ +

12.1  glutDisplayFunc

+ +

12.2  glutOverlayDisplayFunc

+ +

12.3  glutReshapeFunc

+ +

12.4  glutCloseFunc

+ +

12.5  glutKeyboardFunc

+ +

12.6  glutSpecialFunc

+ The "glutSpecialFunc" function sets the window's special key press + callback. Freeglut calls the special key press callback when the +user presses a special key. +

Usage

+ +

void glutSpecialFunc ( void (*func) +( int key, int x, int y ) ) ;

+ +

func    The window's +new special key press callback function
+ key     The +key whose press triggers the callback
+ x       + The x-coordinate of the mouse relative +to the window at the time the key is pressed
+ y       + The y-coordinate of the mouse relative +to the window at the time the key is pressed

+ +

Description

+ +

The  "glutSpecialFunc" +function specifies the function that freeglut will call when the user +presses a special key on the keyboard.  The callback function has one +argument:  the name of the function to be invoked ("called back") at +the time at which the special key is pressed.  The function returns no +value.  Freeglut sets the current window to the window +which is active when the callback is invoked.  "Special keys" are the +function keys, the arrow keys, the Page Up and Page Down keys, and the Insert +key.  The Delete key is considered to be a regular key.
+     Calling "glutSpecialUpFunc" with a NULL argument +disables the call to the window's special key press callback.

+ +

    The "key +" argument may take one of the following defined constant values:

+ + + Changes From GLUT +

None.

+ +

12.7  glutKeyboardUpFunc

+ The "glutKeyboardUpFunc" function sets the window's key release + callback. Freeglut calls the key release callback when the user releases +a key. +

Usage

+ +

void glutKeyboardUpFunc ( void (*func) +( unsigned char key, int x, int y ) ) ;

+ +

func    The window's +new key release callback function
+ key     The +key whose release triggers the callback
+ x       + The x-coordinate of the mouse relative +to the window at the time the key is released
+ y       + The y-coordinate of the mouse relative +to the window at the time the key is released

+ +

Description

+ +

The  "glutKeyboardUpFunc +" function specifies the function that freeglut will call when the +user releases a key from the keyboard.  The callback function has one +argument:  the name of the function to be invoked ("called back") at +the time at which the key is released.  The function returns no value.  + Freeglut sets the current window + to the window which is active when the callback is invoked.
+     While freeglut checks for upper or lower case +letters, it does not do so for non-alphabetical characters.  Nor does +it account for the Caps-Lock key being on.  The operating system may +send some unexpected characters to freeglut, such as "8" when the +user is pressing the Shift key.  Freeglut also invokes the callback +when the user releases the Control, Alt, or Shift keys, among others.  +Releasing the Delete key causes this function to be invoked with a value +of 127 for "key".
+     Calling "glutKeyboardUpFunc" with a NULL argument +disables the call to the window's key release callback.

+ +

Changes From GLUT

+ +

This function is not implemented in GLUT +versions before Version 4.  It has been designed to be as close to GLUT +as possible.  Users who find differences should contact the + freeglut Programming Consortium to +have them fixed.

+ +

12.8  glutSpecialUpFunc

+ The "glutSpecialUpFunc" function sets the window's special key release callback. Freeglut calls the special key release callback -when the user releases a special key. -

Usage -

void glutSpecialUpFunc ( void (*func) ( int key, int x, int y ) -) ; -

func    The window's new special key release -callback function -
key     The key whose release triggers -the callback -
x       The x-coordinate of -the mouse relative to the window at the time the key is released -
y       The y-coordinate of -the mouse relative to the window at the time the key is released -

Description -

The  "glutSpecialUpFunc" function specifies the function -that freeglut will call when the user releases a special key from -the keyboard.  The callback function has one argument:  the name -of the function to be invoked ("called back") at the time at which the -special key is released.  The function returns no value.  Freeglut -sets the current window to the window which is active when the callback -is invoked.  "Special keys" are the function keys, the arrow keys, -the Page Up and Page Down keys, and the Insert key.  The Delete key -is considered to be a regular key. -
    Calling "glutSpecialUpFunc" with a NULL -argument disables the call to the window's special key release callback. -

    The "key" argument may take one of the following -defined constant values: -

-Changes From GLUT -

This function is not implemented in GLUT versions before Version 4.  -It has been designed to be as close to GLUT as possible.  Users who -find differences should contact the freeglut development team to -have them fixed. -

-12.9  glutMouseFunc

- -

-12.10  glutMotionFunc, glutPassiveMotionFunc

- -

-12.11  glutVisibilityFunc

- -

-12.12  glutEntryFunc

- -

-12.13  glutJoystickFunc

- -

-12.14  glutSpaceballMotionFunc

- -

-12.15  glutSpaceballRotateFunc

- -

-12.16  glutSpaceballButtonFunc

- -

-12.17  glutButtonBoxFunc

- -

-12.18  glutDialsFunc

- -

-12.19  glutTabletMotionFunc

- -

-12.20  glutTabletButtonFunc

- -

-12.21  glutMenuStatusFunc

- -

-12.22  glutWindowStatusFunc

- -

-13.0  State Setting and Retrieval Functions

- -

-13.1  glutSetOption

- -

-13.2  glutGet

- -

-The following state variables may be queried with glutGet. -The returned value is an integer. -

- -

-These queries are with respect to the current window: -

- - - -

-These queries do not depend on the current window. -

- - - - - -

-13.3  glutDeviceGet

- -

-13.4  glutGetModifiers

- -

-13.5  glutLayerGet

- -

-13.6  glutExtensionSupported

- -

-13.7  glutGetProcAddress

-

-glutGetProcAddress returns a pointer to a named GL or FreeGLUT function. -

-

Usage -

void *glutGetProcAddress ( const char *procName ) ; -

procName        Name of -an OpenGL or GLUT function. -

-

Description -

glutGetProcAddress is useful for dealing with OpenGL extensions. -If an application calls OpenGL extension functions directly, that application -will only link/run with an OpenGL library that supports the extension. -By using a function pointer returned from glutGetProcAddress(), the -application will avoid this hard dependency and be more portable and -interoperate better with various implementations of OpenGL. -

-

-Both OpenGL functions and FreeGLUT functions can be queried with this function. -Since WGL returns context-dependent function pointers, glutGetProcAddress -should be queried per FreeGLUT window. -

-

-NOTE: this function is not supported in GLUT. -

- - - -

-14.0  Font Rendering Functions

-Freeglut supports two types of font rendering:  bitmap fonts, -which are rendered using the "glBitmap" function call, and stroke -fonts, which are rendered as sequences of OpenGL line segments.  Because -they are rendered as bitmaps, the bitmap fonts tend to render more quickly -than stroke fonts, but they are less flexible in terms of scaling and rendering.  -Bitmap font characters are positioned with calls to the "glRasterPos* -" functions while stroke font characters use the OpenGL transformations -to position characters. -

    It should be noted that freeglut fonts are -similar but not identical to GLUT fonts.  At the moment, freeglut -fonts do not support the "`" (backquote) and "|" (vertical line) characters; -in their place it renders asterisks. -

    Freeglut supports the following bitmap fonts: -

-Freeglut calls "glRasterPos4v" to advance the cursor by +when the user releases a special key. +

Usage

+ +

void glutSpecialUpFunc ( void (*func) +( int key, int x, int y ) ) ;

+ +

func    The window's +new special key release callback function
+ key     The +key whose release triggers the callback
+ x       + The x-coordinate of the mouse relative +to the window at the time the key is released
+ y       + The y-coordinate of the mouse relative +to the window at the time the key is released

+ +

Description

+ +

The  "glutSpecialUpFunc +" function specifies the function that freeglut will call when the +user releases a special key from the keyboard.  The callback function +has one argument:  the name of the function to be invoked ("called back") +at the time at which the special key is released.  The function returns +no value.  Freeglut sets the current window to the window +which is active when the callback is invoked.  "Special keys" are the +function keys, the arrow keys, the Page Up and Page Down keys, and the Insert +key.  The Delete key is considered to be a regular key.
+     Calling "glutSpecialUpFunc" with a NULL argument +disables the call to the window's special key release callback.

+ +

    The "key +" argument may take one of the following defined constant values:

+ + + Changes From GLUT +

This function is not implemented in GLUT +versions before Version 4.  It has been designed to be as close to GLUT +as possible.  Users who find differences should contact the + freeglut Programming Consortium to +have them fixed.

+ +

12.9  glutMouseFunc

+ +

12.10  glutMotionFunc, glutPassiveMotionFunc

+ +

12.11  glutVisibilityFunc

+ +

12.12  glutEntryFunc

+ +

12.13  glutJoystickFunc

+ +

12.14  glutSpaceballMotionFunc

+ The "glutSpaceballMotionFunc" function is not implemented in + freeglut, although the library does +"answer the mail" to the extent that a call to the function will not produce +an error.. +

Usage

+ +

void glutSpaceballMotionFunc ( void +(* callback)( int x, int y, int z ) ) ;

+ +

Description

+ +

The "glutSpaceballMotionFunc + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.15  glutSpaceballRotateFunc

+ The "glutSpaceballRotateFunc" function is not implemented in + freeglut, although the library does +"answer the mail" to the extent that a call to the function will not produce +an error.. +

Usage

+ +

void glutSpaceballRotateFunc ( void +(* callback)( int x, int y, int z ) ) ;

+ +

Description

+ +

The "glutSpaceballRotateFunc + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.16  glutSpaceballButtonFunc

+ The "glutSpaceballButtonFunc" function is not implemented in + freeglut, although the library does +"answer the mail" to the extent that a call to the function will not produce +an error.. +

Usage

+ +

void glutSpaceballButtonFunc ( void +(* callback)( int button, int updown ) ) ;

+ +

Description

+ +

The "glutSpaceballButtonFunc + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.17  glutButtonBoxFunc

+ The "glutSpaceballButtonBoxFunc" function is not implemented +in freeglut, although the library does "answer the mail" to the extent +that a call to the function will not produce an error.. + +

Usage

+ +

void glutSpaceballButtonBoxFunc ( +void (* callback)( int button, int updown ) ) ;

+ +

Description

+ +

The "glutSpaceballButtonBoxFunc + " function is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.18  glutDialsFunc

+ The "glutDialsFunc" function is not implemented in freeglut + , although the library does "answer the mail" to the extent that a call +to the function will not produce an error.. + +

Usage

+ +

void glutDialsFunc ( void (* callback)( +int dial, int value ) ) ;

+ +

Description

+ +

The "glutDialsFunc" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.19  glutTabletMotionFunc

+ The "glutTabletMotionFunc" function is not implemented in + freeglut, although the library does "answer the mail" to the extent +that a call to the function will not produce an error.. + +

Usage

+ +

void glutTabletMotionFunc ( void +(* callback)( int x, int y ) ) ;

+ +

Description

+ +

The "glutTabletMotionFunc" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.20  glutTabletButtonFunc

+ The "glutTabletButtonFunc" function is not implemented in + freeglut, although the library does "answer the mail" to the extent +that a call to the function will not produce an error.. + +

Usage

+ +

void glutTabletButtonFunc ( void +(* callback)( int button, int updown, int x, int y ) ) ;

+ +

Description

+ +

The "glutTabletButtonFunc" function +is not implemented in freeglut.

+ +

Changes From GLUT

+ +

GLUT implements this function.

+ +

12.21  glutMenuStatusFunc

+ +

12.22  glutWindowStatusFunc

+ +

13.0  + State Setting and Retrieval Functions

+ +

13.1  glutSetOption

+ +

13.2  glutGet

+ +

13.3  glutDeviceGet

+ +

13.4  glutGetModifiers

+ +

13.5  glutLayerGet

+ +

13.6  glutExtensionSupported

+ +

13.7  glutGetProcAddress

+

glutGetProcAddress returns +a pointer to a named GL or FreeGLUT function.

+

Usage

+

void *glutGetProcAddress ( const +char *procName ) ;

+

procName        + Name of an OpenGL or GLUT function. +

+

Description

+

glutGetProcAddress is useful +for dealing with OpenGL extensions. If an application calls OpenGL extension +functions directly, that application will only link/run with an OpenGL library +that supports the extension. By using a function pointer returned from glutGetProcAddress(), +the application will avoid this hard dependency and be more portable and interoperate +better with various implementations of OpenGL.

+

Both OpenGL functions and FreeGLUT +functions can be queried with this function.

+

NOTE: this function is not supported +in GLUT.

+

14.0  + Font Rendering Functions

+ Freeglut supports two types of font rendering:  bitmap fonts, + which are rendered using the "glBitmap" function call, and stroke + fonts, which are rendered as sequences of OpenGL line segments.  Because + they are rendered as bitmaps, the bitmap fonts tend to render more quickly + than stroke fonts, but they are less flexible in terms of scaling and rendering.  + Bitmap font characters are positioned with calls to the "glRasterPos* + " functions while stroke font characters use the OpenGL transformations +to position characters. +

    It should be noted +that freeglut fonts are similar but not identical to GLUT fonts.  +At the moment, freeglut fonts do not support the "`" (backquote) and +"|" (vertical line) characters; in their place it renders asterisks.

+ +

    Freeglut supports +the following bitmap fonts:

+ + + Freeglut calls "glRasterPos4v" to advance the cursor by the width of a character and to render carriage returns when appropriate.  -It does not use any display lists in it rendering in bitmap fonts. -

    Freeglut supports the following stroke fonts: -

-Freeglut does not use any display lists in its rendering of stroke -fonts.  It calls "glTranslatef" to advance the cursor by -the width of a character and to render carriage returns when appropriate. -

-14.1  glutBitmapCharacter

-The "glutBitmapCharacter" function renders a single bitmapped -character in the current window using the specified font. -

Usage -

void glutBitmapCharacter ( void *font, int character ) ; -

font        The bitmapped -font to use in rendering the character -
character   The ASCII code of the character to be -rendered -

Description -

The  "glutBitmapCharacter " function renders the given -character in the specified bitmap font.  Freeglut automatically -sets the necessary pixel unpack storage modes and restores the existing -modes when it has finished.  Before the first call to "glutBitMapCharacter -" the application program should call "glRasterPos*" to set the -position of the character in the window.  The "glutBitmapCharacter" -function advances the cursor position as part of its call to "glBitmap" -and so the application does not need to call "glRasterPos*" again -for successive characters on the same line. -

Changes From GLUT -

Nonexistent characters are rendered as asterisks.  The rendering -position in freeglut is apparently off from GLUT's position by a -few pixels vertically and one or two pixels horizontally. -

-14.2  glutBitmapString

-The "glutBitmapString" function renders a string of bitmapped -characters in the current window using the specified font. -

Usage -

void glutBitmapString ( void *font, char *string ) ; -

font      The bitmapped font to use -in rendering the character string -
string    String of characters to be rendered -

Description -

The  "glutBitmapString " function renders the given character -string in the specified bitmap font.  Freeglut automatically -sets the necessary pixel unpack storage modes and restores the existing -modes when it has finished.  Before calling "glutBitMapString" -the application program should call "glRasterPos*" to set the -position of the string in the window.  The "glutBitmapString" -function handles carriage returns.  Nonexistent characters are rendered -as asterisks. -

Changes From GLUT -

GLUT does not include this function. -

-14.3  glutBitmapWidth

-The "glutBitmapWidth" function returns the width in pixels of -a single bitmapped character in the specified font. -

Usage -

int glutBitmapWidth ( void *font, int character ) ; -

font        The bitmapped -font to use in calculating the character width -
character   The ASCII code of the character -

Description -

The  "glutBitmapWidth" function returns the width of the -given character in the specified bitmap font.  Because the font is -bitmapped, the width is an exact integer. -

Changes From GLUT -

Nonexistent characters return the width of an asterisk. -

-14.4  glutBitmapLength

-The "glutBitmapLength" function returns the width in pixels of -a string of bitmapped characters in the specified font. -

Usage -

int glutBitmapLength ( void *font, char *string ) ; -

font    The bitmapped font to use in calculating -the character width -
string  String of characters whose width is to be calculated -

Description -

The  "glutBitmapLength " function returns the width in -pixels of the given character string in the specified bitmap font.  -Because the font is bitmapped, the width is an exact integer:  the -return value is identical to the sum of the character widths returned by -a series of calls to "glutBitmapWidth".  The width of nonexistent -characters is counted to be the width of an asterisk. -

    If the string contains one or more carriage returns, -freeglut -calculates the widths in pixels of the lines separately and returns the -largest width. -

Changes From GLUT -

GLUT does not include this function. -

-14.5  glutBitmapHeight

-The "glutBitmapHeight" function returns the height in pixels of -the specified font. -

Usage -

int glutBitmapHeight ( void *font ) ; -

font        The bitmapped -font to use in calculating the character height -

Description -

The  "glutBitmapHeight " function returns the height of -a character in the specified bitmap font.  Because the font is bitmapped, -the height is an exact integer.  The fonts are designed such that -all characters have (nominally) the same height. -

Changes From GLUT -

GLUT does not include this function. -

-14.6  glutStrokeCharacter

-The "glutStrokeCharacter" function renders a single stroke character -in the current window using the specified font. -

Usage -

void glutStrokeCharacter ( void *font, int character ) ; -

font        The stroke font -to use in rendering the character -
character   The ASCII code of the character to be -rendered -

Description -

The  "glutStrokeCharacter " function renders the given -character in the specified stroke font.  Before the first call to -"glutStrokeCharacter" the application program should call the -OpenGL transformation (positioning and scaling) functions to set the position -of the character in the window.  The "glutStrokeCharacter -" function advances the cursor position by a call to "glTranslatef -" and so the application does not need to call the OpenGL positioning functions -again for successive characters on the same line. -

Changes From GLUT -

Nonexistent characters are rendered as asterisks. -

-14.7  glutStrokeString

-The "glutStrokeString" function renders a string of characters -in the current window using the specified stroke font. -

Usage -

void glutStrokeString ( void *font, char *string ) ; -

font      The stroke font to use in -rendering the character string -
string    String of characters to be rendered -

Description -

The  "glutStrokeString " function renders the given character -string in the specified stroke font.  Before calling "glutStrokeString" -the application program should call the OpenGL transformation (positioning -and scaling) functions to set the position of the string in the window.  -The "glutStrokeString " function handles carriage returns.  -Nonexistent characters are rendered as asterisks. -

Changes From GLUT -

GLUT does not include this function. -

-14.8  glutStrokeWidth

-The "glutStrokeWidth" function returns the width in pixels of -a single character in the specified stroke font. -

Usage -

int glutStrokeWidth ( void *font, int character ) ; -

font        The stroke font -to use in calculating the character width -
character   The ASCII code of the character -

Description -

The  "glutStrokeWidth" function returns the width of the -given character in the specified stroke font.  Because the font is -a stroke font, the width is actually a floating-point number; the function -rounds it to the nearest integer for the return value. -

Changes From GLUT -

Nonexistent characters return the width of an asterisk. -

-14.9  glutStrokeLength

-The "glutStrokeLength" function returns the width in pixels of -a string of characters in the specified stroke font. -

Usage -

int glutStrokeLength ( void *font, char *string ) ; -

font    The stroke font to use in calculating -the character width -
string  String of characters whose width is to be calculated -

Description -

The  "glutStrokeLength " function returns the width in -pixels of the given character string in the specified stroke font.  -Because the font is a stroke font, the width of an individual character -is a floating-point number.  Freeglut adds the floating-point -widths and rounds the funal result to return the integer value.  Thus -the return value may differ from the sum of the character widths returned -by a series of calls to "glutStrokeWidth ".  The width of -nonexistent characters is counted to be the width of an asterisk. -

    If the string contains one or more carriage returns, -freeglut -calculates the widths in pixels of the lines separately and returns the -largest width. -

Changes From GLUT -

GLUT does not include this function. -

-14.10  glutStrokeHeight

-The "glutStrokeHeight" function returns the height in pixels of -the specified font. -

Usage -

GLfloat glutStrokeHeight ( void *font ) ; -

font        The stroke font -to use in calculating the character height -

Description -

The  "glutStrokeHeight " function returns the height of -a character in the specified stroke font.  The application programmer -should note that, unlike the other freeglut font functions, this -one returns a floating-point number.  The fonts are designed such -that all characters have (nominally) the same height. -

Changes From GLUT -

GLUT does not include this function. -

-15.0  Geometric Object Rendering Functions

-Freeglut includes eighteen routines for generating easily-recognizable -3-d geometric objects.  These routines are effectively the same ones -that are included in the GLUT library, and reflect the functionality available -in the aux toolkit described in the OpenGL Programmer's Guide -.  They are included to allow programmers to create with a single + It does not use any display lists in it rendering in bitmap fonts. + +

    Freeglut supports +the following stroke fonts:

+ + + Freeglut does not use any display lists in its rendering of stroke + fonts.  It calls "glTranslatef" to advance the cursor by the +width of a character and to render carriage returns when appropriate. + +

14.1  glutBitmapCharacter

+ The "glutBitmapCharacter" function renders a single bitmapped +character in the current window using the specified font. + +

Usage

+ +

void glutBitmapCharacter ( void *font, +int character ) ;

+ +

font        + The bitmapped font to use in rendering +the character
+ character   The ASCII +code of the character to be rendered

+ +

Description

+ +

The  "glutBitmapCharacter + " function renders the given character in the specified bitmap font.  + Freeglut automatically sets the necessary +pixel unpack storage modes and restores the existing modes when it has finished.  +Before the first call to "glutBitMapCharacter " the application +program should call "glRasterPos*" to set the position of the character +in the window.  The "glutBitmapCharacter " function advances +the cursor position as part of its call to "glBitmap " and so the +application does not need to call "glRasterPos*" again for successive +characters on the same line.

+ +

Changes From GLUT

+ +

Nonexistent characters are rendered as +asterisks.  The rendering position in freeglut is apparently off +from GLUT's position by a few pixels vertically and one or two pixels horizontally. +

+ +

14.2  glutBitmapString

+ The "glutBitmapString" function renders a string of bitmapped +characters in the current window using the specified font. + +

Usage

+ +

void glutBitmapString ( void *font, +char *string ) ;

+ +

font      + The bitmapped font to use in rendering +the character string
+ string    String +of characters to be rendered

+ +

Description

+ +

The  "glutBitmapString + " function renders the given character string in the specified bitmap font.  + Freeglut automatically sets the necessary +pixel unpack storage modes and restores the existing modes when it has finished.  +Before calling "glutBitMapString" the application program should +call "glRasterPos*" to set the position of the string in the window.  +The "glutBitmapString" function handles carriage returns.  +Nonexistent characters are rendered as asterisks.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

14.3  glutBitmapWidth

+ The "glutBitmapWidth" function returns the width in pixels of +a single bitmapped character in the specified font. + +

Usage

+ +

int glutBitmapWidth ( void *font, +int character ) ;

+ +

font        + The bitmapped font to use in calculating +the character width
+ character   The ASCII +code of the character

+ +

Description

+ +

The  "glutBitmapWidth" +function returns the width of the given character in the specified bitmap +font.  Because the font is bitmapped, the width is an exact integer. +

+ +

Changes From GLUT

+ +

Nonexistent characters return the width +of an asterisk.

+ +

14.4  glutBitmapLength

+ The "glutBitmapLength" function returns the width in pixels of +a string of bitmapped characters in the specified font. + +

Usage

+ +

int glutBitmapLength ( void *font, +char *string ) ;

+ +

font    The bitmapped +font to use in calculating the character width
+ string  String of characters +whose width is to be calculated

+ +

Description

+ +

The  "glutBitmapLength + " function returns the width in pixels of the given character string in +the specified bitmap font.  Because the font is bitmapped, the width +is an exact integer:  the return value is identical to the sum of the +character widths returned by a series of calls to "glutBitmapWidth +".  The width of nonexistent characters is counted to be the width of +an asterisk.

+ +

    If the string contains +one or more carriage returns, freeglut calculates the widths in pixels +of the lines separately and returns the largest width.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

14.5  glutBitmapHeight

+ The "glutBitmapHeight" function returns the height in pixels of + the specified font. +

Usage

+ +

int glutBitmapHeight ( void *font +) ;

+ +

font        + The bitmapped font to use in calculating +the character height

+ +

Description

+ +

The  "glutBitmapHeight + " function returns the height of a character in the specified bitmap font.  +Because the font is bitmapped, the height is an exact integer.  The fonts +are designed such that all characters have (nominally) the same height. +

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

14.6  glutStrokeCharacter

+ The "glutStrokeCharacter" function renders a single stroke character + in the current window using the specified font. + +

Usage

+ +

void glutStrokeCharacter ( void *font, +int character ) ;

+ +

font        + The stroke font to use in rendering +the character
+ character   The ASCII +code of the character to be rendered

+ +

Description

+ +

The  "glutStrokeCharacter + " function renders the given character in the specified stroke font.  +Before the first call to "glutStrokeCharacter" the application program +should call the OpenGL transformation (positioning and scaling) functions +to set the position of the character in the window.  The "glutStrokeCharacter + " function advances the cursor position by a call to "glTranslatef + " and so the application does not need to call the OpenGL positioning functions + again for successive characters on the same line.

+ +

Changes From GLUT

+ +

Nonexistent characters are rendered as +asterisks.

+ +

14.7  glutStrokeString

+ The "glutStrokeString" function renders a string of characters +in the current window using the specified stroke font. + +

Usage

+ +

void glutStrokeString ( void *font, +char *string ) ;

+ +

font      + The stroke font to use in rendering +the character string
+ string    String +of characters to be rendered

+ +

Description

+ +

The  "glutStrokeString + " function renders the given character string in the specified stroke font.  +Before calling "glutStrokeString" the application program should +call the OpenGL transformation (positioning and scaling) functions to set +the position of the string in the window.  The "glutStrokeString + " function handles carriage returns.  Nonexistent characters are rendered +as asterisks.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

14.8  glutStrokeWidth

+ The "glutStrokeWidth" function returns the width in pixels of +a single character in the specified stroke font. + +

Usage

+ +

int glutStrokeWidth ( void *font, +int character ) ;

+ +

font        + The stroke font to use in calculating +the character width
+ character   The ASCII +code of the character

+ +

Description

+ +

The  "glutStrokeWidth" +function returns the width of the given character in the specified stroke +font.  Because the font is a stroke font, the width is actually a floating-point +number; the function rounds it to the nearest integer for the return value. +

+ +

Changes From GLUT

+ +

Nonexistent characters return the width +of an asterisk.

+ +

14.9  glutStrokeLength

+ The "glutStrokeLength" function returns the width in pixels of +a string of characters in the specified stroke font. + +

Usage

+ +

int glutStrokeLength ( void *font, +char *string ) ;

+ +

font    The stroke +font to use in calculating the character width
+ string  String of characters +whose width is to be calculated

+ +

Description

+ +

The  "glutStrokeLength + " function returns the width in pixels of the given character string in +the specified stroke font.  Because the font is a stroke font, the width +of an individual character is a floating-point number.  Freeglut + adds the floating-point widths and rounds the funal result to return the +integer value.  Thus the return value may differ from the sum of the +character widths returned by a series of calls to "glutStrokeWidth + ".  The width of nonexistent characters is counted to be the width +of an asterisk.

+ +

    If the string contains +one or more carriage returns, freeglut calculates the widths in pixels +of the lines separately and returns the largest width.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

14.10  glutStrokeHeight

+ The "glutStrokeHeight" function returns the height in pixels of + the specified font. +

Usage

+ +

GLfloat glutStrokeHeight ( void *font +) ;

+ +

font        + The stroke font to use in calculating +the character height

+ +

Description

+ +

The  "glutStrokeHeight + " function returns the height of a character in the specified stroke font.  +The application programmer should note that, unlike the other freeglut + font functions, this one returns a floating-point number.  The fonts +are designed such that all characters have (nominally) the same height.

+ +

Changes From GLUT

+ +

GLUT does not include this function. +

+ +

15.0  + Geometric Object Rendering Functions

+ Freeglut includes eighteen routines for generating easily-recognizable + 3-d geometric objects.  These routines are effectively the same ones + that are included in the GLUT library, and reflect the functionality available + in the aux toolkit described in the OpenGL Programmer's Guide + .  They are included to allow programmers to create with a single line of code a three-dimensional object which can be used to test a variety -of OpenGL functionality.  None of the routines generates a display -list for the object which it draws.  The functions generate normals -appropriate for lighting but, except for the teapon functions, do not generate -texture coordinates. -

-15.1  glutWireSphere, glutSolidSphere

-The "glutWireSphere" and "glutSolidSphere" functions -draw a wireframe and solid sphere respectively. -

Usage -

void glutWireSphere ( GLdouble dRadius, GLint slices, GLint stacks -) ; -

void glutSolidSphere ( GLdouble dRadius, GLint slices, GLint stacks -) ; -

dRadius       The desired radius -of the sphere -

slices        The desired -number of slices (divisions in the longitudinal direction) in the sphere -

stacks        The desired -number of stacks (divisions in the latitudinal direction) in the sphere.  -The number of points in this direction, including the north and south poles, -is stacks+1 -

Description -

The "glutWireSphere" and " glutSolidSphere" functions -render a sphere centered at the origin of the modeling coordinate system.  -The north and south poles of the sphere are on the positive and negative -Z-axes respectively and the prime meridian crosses the positive X-axis. -

Changes From GLUT -

None that we know of. -

-15.2  glutWireTorus, glutSolidTorus

-The "glutWireTorus" and "glutSolidTorus" functions draw -a wireframe and solid torus (donut shape) respectively. -

Usage -

void glutWireTorus ( GLdouble dInnerRadius, GLdouble dOuterRadius, -GLint nSides, GLint nRings ) ; -

void glutSolidTorus ( GLdouble dInnerRadius, GLdouble dOuterRadius, -GLint nSides, GLint nRings ) ; -

dInnerRadius        The -desired inner radius of the torus, from the origin to the circle defining -the centers of the outer circles -

dOuterRadius        The -desired outer radius of the torus, from the center of the outer circle -to the actual surface of the torus -

nSides        The desired -number of segments in a single outer circle of the torus -

nRings        The desired -number of outer circles around the origin of the torus -

Description -

The "glutWireTorus" and " glutSolidTorus" functions -render a torus centered at the origin of the modeling coordinate system.  -The torus is circularly symmetric about the Z-axis and starts at the positive -X-axis. -

Changes From GLUT -

None that we know of. -

-15.3  glutWireCone, glutSolidCone

-The "glutWireCone" and "glutSolidCone" functions draw -a wireframe and solid cone respectively. -

Usage -

void glutWireCone ( GLdouble base, GLdouble height, GLint slices, -GLint stacks ) ; -

void glutSolidCone ( GLdouble base, GLdouble height, GLint slices, -GLint stacks ) ; -

base          The -desired radius of the base of the cone -

height        The desired -height of the cone -

slices        The desired -number of slices around the base of the cone -

stacks        The desired -number of segments between the base and the tip of the cone (the number -of points, including the tip, is stacks + 1) -

Description -

The "glutWireCone" and " glutSolidCone" functions -render a right circular cone with a base centered at the origin and in -the X-Y plane and its tip on the positive Z-axis.  The wire cone is -rendered with triangular elements. -

Changes From GLUT -

None that we know of. -

-15.4  glutWireCube, glutSolidCube

-The "glutWireCube" and "glutSolidCube" functions draw -a wireframe and solid cube respectively. -

Usage -

void glutWireCube ( GLdouble dSize ) ; -

void glutSolidCube ( GLdouble dSize ) ; -

dSize         The desired -length of an edge of the cube -

Description -

The "glutWireCube" and " glutSolidCube" functions -render a cube of the desired size, centered at the origin.  Its faces -are normal to the coordinate directions. -

Changes From GLUT -

None that we know of. -

-15.5  glutWireTetrahedron, glutSolidTetrahedron

-The "glutWireTetrahedron" and "glutSolidTetrahedron" +of OpenGL functionality.  None of the routines generates a display list +for the object which it draws.  The functions generate normals appropriate +for lighting but, except for the teapon functions, do not generate texture +coordinates. +

15.1  glutWireSphere, glutSolidSphere

+ The "glutWireSphere" and "glutSolidSphere" functions +draw a wireframe and solid sphere respectively. + +

Usage

+ +

void glutWireSphere ( GLdouble dRadius, +GLint slices, GLint stacks ) ;

+ +

void glutSolidSphere ( GLdouble dRadius, +GLint slices, GLint stacks ) ;

+ +

dRadius       + The desired radius of the sphere

+ +

slices        + The desired number of slices (divisions +in the longitudinal direction) in the sphere

+ +

stacks        + The desired number of stacks (divisions +in the latitudinal direction) in the sphere.  The number of points in +this direction, including the north and south poles, is stacks+1 +

+ +

Description

+ +

The "glutWireSphere" and " + glutSolidSphere" functions render a sphere centered at the origin +of the modeling coordinate system.  The north and south poles of the +sphere are on the positive and negative Z-axes respectively and the prime +meridian crosses the positive X-axis.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.2  glutWireTorus, glutSolidTorus

+ The "glutWireTorus" and "glutSolidTorus" functions draw + a wireframe and solid torus (donut shape) respectively. + +

Usage

+ +

void glutWireTorus ( GLdouble dInnerRadius, +GLdouble dOuterRadius, GLint nSides, GLint nRings ) ;

+ +

void glutSolidTorus ( GLdouble dInnerRadius, +GLdouble dOuterRadius, GLint nSides, GLint nRings ) ;

+ +

dInnerRadius        + The desired inner radius of the torus, +from the origin to the circle defining the centers of the outer circles

+ +

dOuterRadius        + The desired outer radius of the torus, +from the center of the outer circle to the actual surface of the torus

+ +

nSides        + The desired number of segments in a +single outer circle of the torus

+ +

nRings        + The desired number of outer circles +around the origin of the torus

+ +

Description

+ +

The "glutWireTorus" and " + glutSolidTorus" functions render a torus centered at the origin of +the modeling coordinate system.  The torus is circularly symmetric about +the Z-axis and starts at the positive X-axis.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.3  glutWireCone, glutSolidCone

+ The "glutWireCone" and "glutSolidCone" functions draw +a wireframe and solid cone respectively. + +

Usage

+ +

void glutWireCone ( GLdouble base, +GLdouble height, GLint slices, GLint stacks ) ;

+ +

void glutSolidCone ( GLdouble base, +GLdouble height, GLint slices, GLint stacks ) ;

+ +

base          + The desired radius of the base of the +cone

+ +

height        + The desired height of the cone

+ +

slices        + The desired number of slices around +the base of the cone

+ +

stacks        + The desired number of segments between +the base and the tip of the cone (the number of points, including the tip, +is stacks + 1)

+ +

Description

+ +

The "glutWireCone" and " + glutSolidCone" functions render a right circular cone with a base +centered at the origin and in the X-Y plane and its tip on the positive Z-axis.  +The wire cone is rendered with triangular elements.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.4  glutWireCube, glutSolidCube

+ The "glutWireCube" and "glutSolidCube" functions draw +a wireframe and solid cube respectively. + +

Usage

+ +

void glutWireCube ( GLdouble dSize +) ;

+ +

void glutSolidCube ( GLdouble dSize +) ;

+ +

dSize         + The desired length of an edge of the +cube

+ +

Description

+ +

The "glutWireCube" and " + glutSolidCube" functions render a cube of the desired size, centered +at the origin.  Its faces are normal to the coordinate directions.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.5  glutWireTetrahedron, glutSolidTetrahedron

+ The "glutWireTetrahedron" and "glutSolidTetrahedron" functions draw a wireframe and solid tetrahedron (four-sided Platonic solid) -respectively. -

Usage -

void glutWireTetrahedron ( void ) ; -

void glutSolidTetrahedron ( void ) ; -

Description -

The "glutWireTetrahedron" and "glutSolidTetrahedron" -functions render a tetrahedron whose corners are each a distance of one -from the origin.  The length of each side is 2/3 sqrt(6).  One -corner is on the positive X-axis and another is in the X-Y plane with a -positive Y-coordinate. -

Changes From GLUT -

None that we know of. -

-15.6  glutWireOctahedron, glutSolidOctahedron

-The "glutWireOctahedron" and "glutSolidOctahedron" functions -draw a wireframe and solid octahedron (eight-sided Platonic solid) respectively. -

Usage -

void glutWireOctahedron ( void ) ; -

void glutSolidOctahedron ( void ) ; -

Description -

The "glutWireOctahedron" and "glutSolidOctahedron" -functions render an octahedron whose corners are each a distance of one -from the origin.  The length of each side is sqrt(2).  The corners -are on the positive and negative coordinate axes. -

Changes From GLUT -

None that we know of. -

-15.7  glutWireDodecahedron, glutSolidDodecahedron

-The "glutWireDodecahedron" and "glutSolidDodecahedron" -functions draw a wireframe and solid dodecahedron (twelve-sided Platonic -solid) respectively. -

Usage -

void glutWireDodecahedron ( void ) ; -

void glutSolidDodecahedron ( void ) ; -

Description -

The "glutWireDodecahedron" and "glutSolidDodecahedron" -functions render a dodecahedron whose corners are each a distance of sqrt(3) -from the origin.  The length of each side is sqrt(5)-1.  There -are twenty corners; interestingly enough, eight of them coincide with the -corners of a cube with sizes of length 2. -

Changes From GLUT -

None that we know of. -

-15.8  glutWireIcosahedron, glutSolidIcosahedron

-The "glutWireIcosahedron" and "glutSolidIcosahedron" -functions draw a wireframe and solid icosahedron (twenty-sided Platonic -solid) respectively. -

Usage -

void glutWireIcosahedron ( void ) ; -

void glutSolidIcosahedron ( void ) ; -

Description -

The "glutWireIcosahedron" and "glutSolidIcosahedron" -functions render an icosahedron whose corners are each a unit distance -from the origin.  The length of each side is slightly greater than -one.  Two of the corners lie on the positive and negative X-axes. -

Changes From GLUT -

None that we know of. -

-15.7  glutWireRhombicDodecahedron, glutSolidRhombicDodecahedron

-The "glutWireRhombicDodecahedron" and "glutSolidRhombicDodecahedron -" functions draw a wireframe and solid rhombic dodecahedron (twelve-sided -semi-regular solid) respectively. -

Usage -

void glutWireRhombicDodecahedron ( void ) ; -

void glutSolidRhombicDodecahedron ( void ) ; -

Description -

The "glutWireRhombicDodecahedron " and "glutSolidRhombicDodecahedron" -functions render a rhombic dodecahedron whose corners are at most a distance -of one from the origin.  The rhombic dodecahedron has faces which -are identical rhombuses (rhombi?) but which have some vertices at which -three faces meet and some vertices at which four faces meet.  The -length of each side is sqrt(3)/2.  Vertices at which four faces meet -are found at (0, 0, +1) and ( +sqrt(2)/2, +sqrt(2)/2, -0). -

Changes From GLUT -

GLUT does not include these functions. -

-15.10  glutWireTeapot, glutSolidTeapot

-The "glutWireTeapot" and "glutSolidTeapot" functions -draw a wireframe and solid teapot respectively. -

Usage -

void glutWireTeapot ( GLdouble dSize ) ; -

void glutSolidTeapot ( GLdouble dSize ) ; -

dSize         The desired -size of the teapot -

Description -

The "glutWireTeapot" and " glutSolidTeapot" functions -render a teapot of the desired size, centered at the origin.  This -is the famous OpenGL teapot [add reference]. -

Changes From GLUT -

None that we know of. -

-16.0  Game Mode Functions

- -

-16.1  glutGameModeString

- -

-16.2  glutEnterGameMode, glutLeaveGameMode

- -

-16.3  glutGameModeGet

- -

-17.0  Video Resize Functions

- -

-17.1  glutVideoResizeGet

- -

-17.2  glutSetupVideoResizing, glutStopVideoResizing

- -

-17.3  glutVideoResize

- -

-17.4  glutVideoPan

- -

-18.0  Color Map Functions

- -

-18.1  glutSetColor, glutGetColor

- -

-18.2  glutCopyColormap

- -

-19.0  Miscellaneous Functions

- -

-19.1  glutIgnoreKeyRepeat, glutSetKeyRepeat

- -

-19.2  glutForceJoystickFunc

- -

-19.3  glutReportErrors

- -

-20.0  Usage Notes

- -

-The following environment variables are recognized by FreeGLUT: -

- - - -

-21.0  Implementation Notes

- -

-22.0  GLUT State

- -

-23.0  "freeglut.h" Header File

- -

-FreeGLUT users should normally just include GL/glut.h in their programs. -Programs which need FreeGLUT-specific functions should also include -GL/freeglut_ext.h as follows: -

- -
-#include <GL/glut.h>
-#ifdef FREEGLUT
-#include <GL/freeglut_ext.h>
-#endif
-
- -

-Compile-time FreeGLUT version testing can be done as follows: -

- -
-#ifdef FREEGLUT_VERSION_1_3
-  code specific to FreeGLUT 1.3 or later here
-#endif
-
- -

-In future releases, FREEGLUT_VERSION_1_4, FREEGLUT_VERSION_1_5, etc will -be defined. This scheme mimics OpenGL conventions. -

- -

-The FreeGLUT version can be queried at runtime by calling -glutGet(GLUT_VERSION). -The result will be X*10000+Y*100+Z where X is the major version, Y is the -minor version and Z is the patch level. -

-

-This may be used as follows: -

- -
-if (glutGet(GLUT_VERSION) < 10300) {
-    printf("Sorry, you need FreeGLUT version 1.3.0 or later to run this program.\n");
-    exit(1);
-}
-
- - -

-24.0  References

- -

-25.0  Index

-  -

  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  - - +respectively. +

Usage

+ +

void glutWireTetrahedron ( void ) +;

+ +

void glutSolidTetrahedron ( void +) ;

+ +

Description

+ +

The "glutWireTetrahedron" and +"glutSolidTetrahedron" functions render a tetrahedron whose corners +are each a distance of one from the origin.  The length of each side +is 2/3 sqrt(6).  One corner is on the positive X-axis and another is +in the X-Y plane with a positive Y-coordinate.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.6  glutWireOctahedron, glutSolidOctahedron

+ The "glutWireOctahedron" and "glutSolidOctahedron" functions + draw a wireframe and solid octahedron (eight-sided Platonic solid) respectively. + +

Usage

+ +

void glutWireOctahedron ( void ) +;

+ +

void glutSolidOctahedron ( void ) +;

+ +

Description

+ +

The "glutWireOctahedron" and +"glutSolidOctahedron" functions render an octahedron whose corners +are each a distance of one from the origin.  The length of each side +is sqrt(2).  The corners are on the positive and negative coordinate +axes.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.7  glutWireDodecahedron, glutSolidDodecahedron

+ The "glutWireDodecahedron" and "glutSolidDodecahedron +" functions draw a wireframe and solid dodecahedron (twelve-sided Platonic +solid) respectively. +

Usage

+ +

void glutWireDodecahedron ( void +) ;

+ +

void glutSolidDodecahedron ( void +) ;

+ +

Description

+ +

The "glutWireDodecahedron" and +"glutSolidDodecahedron" functions render a dodecahedron whose corners +are each a distance of sqrt(3) from the origin.  The length of each +side is sqrt(5)-1.  There are twenty corners; interestingly enough, +eight of them coincide with the corners of a cube with sizes of length 2. +

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.8  glutWireIcosahedron, glutSolidIcosahedron

+ The "glutWireIcosahedron" and "glutSolidIcosahedron" +functions draw a wireframe and solid icosahedron (twenty-sided Platonic solid) +respectively. +

Usage

+ +

void glutWireIcosahedron ( void ) +;

+ +

void glutSolidIcosahedron ( void +) ;

+ +

Description

+ +

The "glutWireIcosahedron" and +"glutSolidIcosahedron" functions render an icosahedron whose corners +are each a unit distance from the origin.  The length of each side is +slightly greater than one.  Two of the corners lie on the positive and +negative X-axes.

+ +

Changes From GLUT

+ +

None that we know of.

+ +

15.7  glutWireRhombicDodecahedron, +glutSolidRhombicDodecahedron

+ The "glutWireRhombicDodecahedron" and "glutSolidRhombicDodecahedron + " functions draw a wireframe and solid rhombic dodecahedron (twelve-sided + semi-regular solid) respectively. +

Usage

+ +

void glutWireRhombicDodecahedron +( void ) ;

+ +

void glutSolidRhombicDodecahedron +( void ) ;

+ +

Description

+ +

The "glutWireRhombicDodecahedron + " and "glutSolidRhombicDodecahedron" functions render a rhombic +dodecahedron whose corners are at most a distance of one from the origin.  +The rhombic dodecahedron has faces which are identical rhombuses (rhombi?) +but which have some vertices at which three faces meet and some vertices at +which four faces meet.  The length of each side is sqrt(3)/2.  Vertices +at which four faces meet are found at (0, 0, +1) and ( +sqrt(2)/2, + +sqrt(2)/2, 0).

+ +

Changes From GLUT

+ +

GLUT does not include these functions. +

+ +

15.10  glutWireTeapot, glutSolidTeapot

+ The "glutWireTeapot" and "glutSolidTeapot" functions +draw a wireframe and solid teapot respectively. + +

Usage

+ +

void glutWireTeapot ( GLdouble dSize +) ;

+ +

void glutSolidTeapot ( GLdouble dSize +) ;

+ +

dSize         + The desired size of the teapot

+ +

Description

+ +

The "glutWireTeapot" and " + glutSolidTeapot" functions render a teapot of the desired size, centered +at the origin.  This is the famous OpenGL teapot [add reference].

+ +

Changes From GLUT

+ +

None that we know of.

+ +

16.0  + Game Mode Functions

+ +

16.1  glutGameModeString

+ +

16.2  glutEnterGameMode, glutLeaveGameMode

+ +

16.3  glutGameModeGet

+ +

17.0  + Video Resize Functions

+ +

17.1  glutVideoResizeGet

+ +

17.2  glutSetupVideoResizing, +glutStopVideoResizing

+ +

17.3  glutVideoResize

+ +

17.4  glutVideoPan

+ +

18.0  + Color Map Functions

+ +

18.1  glutSetColor, glutGetColor

+ +

18.2  glutCopyColormap

+ +

19.0  + Miscellaneous Functions

+ +

19.1  glutIgnoreKeyRepeat, glutSetKeyRepeat

+ +

19.2  glutForceJoystickFunc

+ +

19.3  glutReportErrors

+ +

20.0  + Usage Notes

+ +

The following environment variables +are recognized by freeglut:

+ +

21.0  + Implementation Notes

+ +

22.0  + GLUT State

+ +

23.0  + "freeglut.h" Header File

+ +

24.0  + References

+ +

25.0  + Index

+   +

 
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  

+ + + diff --git a/freeglut-1.3/freeglut_callbacks.c b/freeglut-1.3/freeglut_callbacks.c index 0438f13..b741a0c 100644 --- a/freeglut-1.3/freeglut_callbacks.c +++ b/freeglut-1.3/freeglut_callbacks.c @@ -231,6 +231,13 @@ void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) ) glutCloseFunc( callback ); } +/* A. Donev: Destruction callback for menus */ +void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) ) +{ + if( fgStructure.Menu == NULL ) return; + fgStructure.Menu->Destroy = callback; +} + /* * Deprecated version of glutMenuStatusFunc callback setting method */ diff --git a/freeglut-1.3/freeglut_ext.c b/freeglut-1.3/freeglut_ext.c index 03a695e..a7897dd 100644 --- a/freeglut-1.3/freeglut_ext.c +++ b/freeglut-1.3/freeglut_ext.c @@ -160,7 +160,12 @@ static struct name_address_pair glut_functions[] = { { "glutLeaveMainLoop", (void *) glutLeaveMainLoop }, { "glutCloseFunc", (void *) glutCloseFunc }, { "glutWMCloseFunc", (void *) glutWMCloseFunc }, - { "glutSetOption ", (void *) glutSetOption }, + { "glutMenuDestroyFunc", (void *) glutMenuDestroyFunc }, + { "glutSetOption", (void *) glutSetOption }, + { "glutSetWindowData", (void *) glutSetWindowData }, + { "glutGetWindowData", (void *) glutGetWindowData }, + { "glutSetMenuData", (void *) glutSetMenuData }, + { "glutGetMenuData", (void *) glutGetMenuData }, { "glutBitmapHeight", (void *) glutBitmapHeight }, { "glutStrokeHeight", (void *) glutStrokeHeight }, { "glutBitmapString", (void *) glutBitmapString }, diff --git a/freeglut-1.3/freeglut_internal.h b/freeglut-1.3/freeglut_internal.h index e4968e9..de91e0f 100644 --- a/freeglut-1.3/freeglut_internal.h +++ b/freeglut-1.3/freeglut_internal.h @@ -29,13 +29,6 @@ #define FREEGLUT_INTERNAL_H /* - * Be sure to update these for every release! - */ -#define VERSION_MAJOR 1 -#define VERSION_MINOR 3 -#define VERSION_PATCH 0 - -/* * Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */ #if !defined(_WIN32) @@ -126,8 +119,6 @@ typedef void (* FGCBmotion )( int, int ); typedef void (* FGCBpassive )( int, int ); typedef void (* FGCBentry )( int ); typedef void (* FGCBwindowStatus )( int ); -typedef void (* FGCBmenuState )( int ); -typedef void (* FGCBmenuStatus )( int, int, int ); typedef void (* FGCBselect )( int, int, int ); typedef void (* FGCBjoystick )( unsigned int, int, int, int ); typedef void (* FGCBkeyboardUp )( unsigned char, int, int ); @@ -147,6 +138,8 @@ typedef void (* FGCBdestroy )( void ); */ typedef void (* FGCBidle )( void ); typedef void (* FGCBtimer )( int ); +typedef void (* FGCBmenuState )( int ); +typedef void (* FGCBmenuStatus )( int, int, int ); /* * The callback used when creating/using menus @@ -386,9 +379,11 @@ typedef struct tagSFG_Menu SFG_Menu; struct tagSFG_Menu { SFG_Node Node; + void *UserData ; /* A. Donev: User data passed back at callback */ int ID; /* The global menu ID */ SFG_List Entries; /* The menu entries list */ FGCBmenu Callback; /* The menu callback */ + FGCBdestroy Destroy; /* A. Donev: Destruction callback */ GLboolean IsActive; /* Is the menu selected? */ int Width; /* Menu box width in pixels */ int Height; /* Menu box height in pixels */ @@ -422,6 +417,7 @@ struct tagSFG_Window SFG_Context Window; /* Window and OpenGL context */ SFG_WindowState State; /* The window state */ SFG_WindowCallbacks Callbacks; /* The window callbacks */ + void *UserData ; /* A. Donev: A pointer to user data used in rendering */ SFG_Menu* Menu[ FREEGLUT_MAX_MENUS ]; /* Menus appended to window */ SFG_Menu* ActiveMenu; /* The window's active menu */ diff --git a/freeglut-1.3/freeglut_menu.c b/freeglut-1.3/freeglut_menu.c index 0527c73..921deec 100644 --- a/freeglut-1.3/freeglut_menu.c +++ b/freeglut-1.3/freeglut_menu.c @@ -204,20 +204,20 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) * Have the menu box drawn first. The +- values are * here just to make it more nice-looking... */ - glColor4f( 0.0, 0.0, 0.0, 1.0 ); + glColor4f( 0.0f, 0.0f, 0.0f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X , menu->Y - 1 ); - glVertex2f( menu->X + menu->Width, menu->Y - 1 ); - glVertex2f( menu->X + menu->Width, menu->Y + 4 + menu->Height ); - glVertex2f( menu->X , menu->Y + 4 + menu->Height ); + glVertex2i( menu->X , menu->Y - 1 ); + glVertex2i( menu->X + menu->Width, menu->Y - 1 ); + glVertex2i( menu->X + menu->Width, menu->Y + 4 + menu->Height ); + glVertex2i( menu->X , menu->Y + 4 + menu->Height ); glEnd(); - glColor4f( 0.3, 0.4, 0.5, 1.0 ); + glColor4f( 0.3f, 0.4f, 0.5f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X - 2 , menu->Y + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + 2 + menu->Height ); - glVertex2f( menu->X - 2 , menu->Y + 2 + menu->Height ); + glVertex2i( menu->X - 2 , menu->Y + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + 2 + menu->Height ); + glVertex2i( menu->X - 2 , menu->Y + 2 + menu->Height ); glEnd(); /* @@ -241,12 +241,12 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * So have the highlight drawn... */ - glColor4f( 0.2, 0.3, 0.4, 1.0 ); + glColor4f( 0.2f, 0.3f, 0.4f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X - 2 , menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); - glVertex2f( menu->X - 2 , menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); + glVertex2i( menu->X - 2 , menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); + glVertex2i( menu->X - 2 , menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); glEnd(); } } @@ -844,4 +844,17 @@ void FGAPIENTRY glutDetachMenu( int button ) fgStructure.Window->Menu[ button ] = NULL; } +/* + * A.Donev: Set and retrieve the menu's user data + */ +void* FGAPIENTRY glutGetMenuData( void ) +{ + return(fgStructure.Menu->UserData); +} + +void FGAPIENTRY glutSetMenuData(void* data) +{ + fgStructure.Menu->UserData=data; +} + /*** END OF FILE ***/ diff --git a/freeglut-1.3/freeglut_structure.c b/freeglut-1.3/freeglut_structure.c index 2c26259..6b54d50 100644 --- a/freeglut-1.3/freeglut_structure.c +++ b/freeglut-1.3/freeglut_structure.c @@ -252,6 +252,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) /* * If the programmer defined a destroy callback, call it + * A. Donev: But first make this the active window */ if ( window->Callbacks.Destroy != NULL ) { @@ -359,6 +360,18 @@ void fgDestroyMenu( SFG_Menu* menu ) } /* + * If the programmer defined a destroy callback, call it + * A. Donev: But first make this the active menu + */ + if ( menu->Destroy != NULL ) + { + SFG_Menu *activeMenu=fgStructure.Menu; + fgStructure.Menu = menu; + menu->Destroy () ; + fgStructure.Menu = activeMenu; + } + + /* * Now we are pretty sure the menu is not used anywhere * and that we can remove all of its entries */ diff --git a/freeglut-1.3/freeglut_teapot.c b/freeglut-1.3/freeglut_teapot.c index 03386b6..f855056 100644 --- a/freeglut-1.3/freeglut_teapot.c +++ b/freeglut-1.3/freeglut_teapot.c @@ -80,7 +80,9 @@ #include "../include/GL/freeglut.h" #include "freeglut_internal.h" - +#ifdef TARGET_HOST_WIN32 +#pragma warning ( once:4305 ) +#endif /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ @@ -166,7 +168,7 @@ static void teapot( GLint grid, GLdouble scale, GLenum type ) glPushMatrix(); glRotatef(270.0, 1.0, 0.0, 0.0); - glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); + glScaled(0.5 * scale, 0.5 * scale, 0.5 * scale); glTranslatef(0.0, 0.0, -1.5); for (i = 0; i < 10; i++) { diff --git a/freeglut-1.3/freeglut_window.c b/freeglut-1.3/freeglut_window.c index 7bd5700..9e4a9e3 100644 --- a/freeglut-1.3/freeglut_window.c +++ b/freeglut-1.3/freeglut_window.c @@ -555,12 +555,10 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i if ( !isSubWindow ) { /* - * Update the window position and dimensions, taking account of window decorations + * Update the window dimensions, taking account of window decorations. + * "freeglut" is to create the window with the outside of its border at (x,y) + * and with dimensions (w,h). */ - - x -= (GetSystemMetrics( SM_CXSIZEFRAME ) ); - y -= (GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ) ); - if ( y < 0 ) y = 0 ; w += (GetSystemMetrics( SM_CXSIZEFRAME ) )*2; h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + GetSystemMetrics( SM_CYCAPTION ); } @@ -1030,8 +1028,8 @@ void FGAPIENTRY glutReshapeWindow( int width, int height ) /* * Adjust the size of the window to allow for the size of the frame */ - width += (GetSystemMetrics( SM_CXSIZEFRAME ) - 1)*2; - height += (GetSystemMetrics( SM_CYSIZEFRAME ) - 1)*2 + GetSystemMetrics( SM_CYCAPTION ); + width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2; + height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 + GetSystemMetrics( SM_CYCAPTION ); } else /* This is a subwindow, get the parent window's position and subtract it off */ { @@ -1078,16 +1076,6 @@ void FGAPIENTRY glutPositionWindow( int x, int y ) */ GetWindowRect( fgStructure.Window->Window.Handle, &winRect ); - if ( fgStructure.Window->Parent == NULL ) /* If this is not a subwindow ... */ - { - /* - * Adjust the position of the window to allow for the size of the frame - */ - x -= (GetSystemMetrics( SM_CXSIZEFRAME ) - 1); - y -= (GetSystemMetrics( SM_CYSIZEFRAME ) - 1 + GetSystemMetrics( SM_CYCAPTION )); - if ( y < 0 ) y = 0 ; - } - /* * Reposition the window, forcing a redraw to happen */ @@ -1176,6 +1164,19 @@ void FGAPIENTRY glutFullScreen( void ) ); } +/* + * A.Donev: Set and retrieve the window's user data + */ +void* FGAPIENTRY glutGetWindowData( void ) +{ + return(fgStructure.Window->UserData); +} + +void FGAPIENTRY glutSetWindowData(void* data) +{ + fgStructure.Window->UserData=data; +} + /*** END OF FILE ***/ diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 0f71c88..e5466ed 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -48,12 +48,6 @@ #define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* - * Runtime version checking with glutGet - */ -#define GLUT_VERSION 0x01FC - - -/* * Process loop function, see freeglut_main.c */ FGAPI void FGAPIENTRY glutMainLoopEvent( void ); @@ -64,11 +58,18 @@ FGAPI void FGAPIENTRY glutLeaveMainLoop( void ); */ FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) ); FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) ); +/* A. Donev: Also a destruction callback for menus */ +FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) ); /* * State setting and retrieval functions, see freeglut_state.c */ FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value ) ; +/* A.Donev: User-data manipulation */ +FGAPI void* FGAPIENTRY glutGetWindowData( void ); +FGAPI void FGAPIENTRY glutSetWindowData(void* data); +FGAPI void* FGAPIENTRY glutGetMenuData( void ); +FGAPI void FGAPIENTRY glutSetMenuData(void* data); /* * Font stuff, see freeglut_font.c -- 1.7.10.4