203ece1e51b33909104606c2a4d0368ee349c9ad
[freeglut] / src / freeglut_internal.h
1 /*
2  * freeglut_internal.h
3  *
4  * The freeglut library private include file.
5  *
6  * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7  * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8  * Creation date: Thu Dec 2 1999
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27
28 #ifndef  FREEGLUT_INTERNAL_H
29 #define  FREEGLUT_INTERNAL_H
30
31 /* XXX Update these for each release! */
32 #define  VERSION_MAJOR 2
33 #define  VERSION_MINOR 0
34 #define  VERSION_PATCH 0 
35
36 /*
37  * Freeglut is meant to be available under all Unix/X11 and Win32 platforms.
38  */
39 #if !defined(_WIN32)
40 #   define  TARGET_HOST_UNIX_X11    1
41 #   define  TARGET_HOST_WIN32       0
42 #else
43 #   define  TARGET_HOST_UNIX_X11    0
44 #   define  TARGET_HOST_WIN32       1
45 #endif
46
47 #define  FREEGLUT_MAX_MENUS         3
48 #define  FREEGLUT_DEBUG             1
49
50 #if FREEGLUT_DEBUG
51     #undef   G_DISABLE_ASSERT
52     #undef   G_DISABLE_CHECKS
53 #else
54     #define  G_DISABLE_ASSERT
55     #define  G_DISABLE_CHECKS
56 #endif
57
58 /*
59  * Somehow all Win32 include headers depend on this one:
60  */
61 #if TARGET_HOST_WIN32
62 #include <windows.h>
63 #include <windowsx.h>
64
65 #define strdup   _strdup
66 #endif
67
68 /*
69  * Those files should be available on every platform.
70  */
71 #include <GL/gl.h>
72 #include <GL/glu.h>
73 #include <stdio.h>
74 #include <string.h>
75 #include <math.h>
76 #include <stdlib.h>
77 #include <assert.h>
78 #include <stdarg.h>
79 #if TARGET_HOST_UNIX_X11
80 #include <sys/time.h>
81 #endif
82
83 /*
84  * The system-dependant include files should go here:
85  */
86 #if TARGET_HOST_UNIX_X11
87     #include <GL/glx.h>
88     #include <X11/Xlib.h>
89     #include <X11/Xatom.h>
90     #include <X11/keysym.h>
91
92     #ifndef __sgi
93     #include <X11/extensions/xf86vmode.h>
94     #endif
95 #endif
96
97 /*
98  * Microsoft VisualC++ 5.0's <math.h> does not define the PI
99  */
100 #ifndef M_PI
101 #    define  M_PI  3.14159265358979323846
102 #endif
103
104 #ifndef TRUE
105 #    define  TRUE  1
106 #endif
107
108 #ifndef FALSE
109 #    define  FALSE  0
110 #endif
111
112 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
113
114 /*
115  * Freeglut callbacks type definitions
116  */
117 typedef void (* FGCBdisplay       )( void );
118 typedef void (* FGCBreshape       )( int, int );
119 typedef void (* FGCBvisibility    )( int );
120 typedef void (* FGCBkeyboard      )( unsigned char, int, int );
121 typedef void (* FGCBspecial       )( int, int, int );
122 typedef void (* FGCBmouse         )( int, int, int, int );
123 typedef void (* FGCBmotion        )( int, int );
124 typedef void (* FGCBpassive       )( int, int );
125 typedef void (* FGCBentry         )( int );
126 typedef void (* FGCBwindowStatus  )( int );
127 typedef void (* FGCBselect        )( int, int, int );
128 typedef void (* FGCBjoystick      )( unsigned int, int, int, int );
129 typedef void (* FGCBkeyboardUp    )( unsigned char, int, int );
130 typedef void (* FGCBspecialUp     )( int, int, int );
131 typedef void (* FGCBoverlayDisplay)( void );
132 typedef void (* FGCBspaceMotion   )( int, int, int );
133 typedef void (* FGCBspaceRotate   )( int, int, int );
134 typedef void (* FGCBspaceButton   )( int, int );
135 typedef void (* FGCBdials         )( int, int );
136 typedef void (* FGCBbuttonBox     )( int, int );
137 typedef void (* FGCBtabletMotion  )( int, int );
138 typedef void (* FGCBtabletButton  )( int, int, int, int );
139 typedef void (* FGCBdestroy       )( void );
140
141 /*
142  * The global callbacks type definitions
143  */
144 typedef void (* FGCBidle          )( void );
145 typedef void (* FGCBtimer         )( int );
146 typedef void (* FGCBmenuState     )( int );
147 typedef void (* FGCBmenuStatus    )( int, int, int );
148
149 /*
150  * The callback used when creating/using menus
151  */
152 typedef void (* FGCBmenu          )( int );
153
154
155 /*
156  * A list structure
157  */
158 typedef struct tagSFG_List SFG_List;
159 struct tagSFG_List
160 {
161     void *First;
162     void *Last;
163 };
164
165 /*
166  * A list node structure
167  */
168 typedef struct tagSFG_Node SFG_Node;
169 struct tagSFG_Node
170 {
171     void *Next;
172     void *Prev;
173 };
174
175 /*
176  * A helper structure holding two ints and a boolean
177  */
178 typedef struct tagSFG_XYUse SFG_XYUse;
179 struct tagSFG_XYUse
180 {
181     GLint           X, Y;               /* The two integers...               */
182     GLboolean       Use;                /* ...and a single boolean.          */
183 };
184
185 /*
186  * A helper structure holding a timeval and a boolean
187  */
188 typedef struct tagSFG_Time SFG_Time;
189 struct tagSFG_Time
190 {
191 #ifdef WIN32
192     DWORD Value;
193 #else
194     struct timeval  Value;
195 #endif
196     GLboolean       Set;
197 };
198
199 /*
200  * An enumeration containing the state of the GLUT execution:  initializing, running, or stopping
201  */
202 typedef enum {
203   GLUT_EXEC_STATE_INIT,
204   GLUT_EXEC_STATE_RUNNING,
205   GLUT_EXEC_STATE_STOP
206 } fgExecutionState ;
207
208 /*
209  * This structure holds different freeglut settings
210  */
211 typedef struct tagSFG_State SFG_State;
212 struct tagSFG_State
213 {
214     SFG_XYUse        Position;             /* The default windows' position     */
215     SFG_XYUse        Size;                 /* The default windows' size         */
216     unsigned int     DisplayMode;          /* The display mode for new windows  */
217
218     GLboolean        ForceDirectContext;   /* Should we force direct contexts?  */
219     GLboolean        TryDirectContext;     /* What about giving a try to?       */
220
221     GLboolean        ForceIconic;          /* All new top windows are iconified */
222
223     GLboolean        GLDebugSwitch;        /* OpenGL state debugging switch     */
224     GLboolean        XSyncSwitch;          /* X11 sync protocol switch          */
225
226     GLboolean        IgnoreKeyRepeat;      /* Whether to ignore key repeat...   */
227
228     GLuint           FPSInterval;          /* Interval between FPS printfs      */
229     GLuint           SwapCount;            /* Count of glutSwapBuffer calls     */
230     GLuint           SwapTime;             /* Time of last SwapBuffers          */
231
232     SFG_Time         Time;                 /* The time that glutInit was called */
233     SFG_List         Timers;               /* The freeglut timer hooks          */
234
235     FGCBidle         IdleCallback;         /* The global idle callback          */
236
237     FGCBmenuState    MenuStateCallback;    /* Menu callbacks are global         */
238     FGCBmenuStatus   MenuStatusCallback;
239
240     SFG_XYUse        GameModeSize;         /* The game mode screen's dimensions */
241     int              GameModeDepth;        /* The pixel depth for game mode     */
242     int              GameModeRefresh;      /* The refresh rate for game mode    */
243
244     int              ActionOnWindowClose ; /* Action when user clicks "x" on window header bar */
245
246     fgExecutionState ExecState ;           /* Current state of the GLUT execution */
247 };
248
249 /*
250  * The structure used by display initialization in freeglut_init.c
251  */
252 typedef struct tagSFG_Display SFG_Display;
253 struct tagSFG_Display
254 {
255 #if TARGET_HOST_UNIX_X11
256     Display*        Display;            /* The display we are being run in.  */
257     int             Screen;             /* The screen we are about to use.   */
258     Window          RootWindow;         /* The screen's root window.         */
259     int             Connection;         /* The display's connection number   */
260     Atom            DeleteWindow;       /* The window deletion atom          */
261
262 #ifdef X_XF86VidModeGetModeLine
263     XF86VidModeModeLine DisplayMode;    /* Current screen's display settings */
264     int             DisplayModeClock;   /* The display mode's refresh rate   */
265 #endif
266
267 #elif TARGET_HOST_WIN32
268     HINSTANCE        Instance;          /* The application's instance        */
269     DEVMODE         DisplayMode;        /* Desktop's display settings        */
270
271 #endif
272
273     int             ScreenWidth;        /* The screen's width in pixels      */
274     int             ScreenHeight;       /* The screen's height in pixels     */
275     int             ScreenWidthMM;      /* The screen's width in milimeters  */
276     int             ScreenHeightMM;     /* The screen's height in milimeters */
277 };
278
279
280 /*
281  * The user can create any number of timer hooks
282  */
283 typedef struct tagSFG_Timer SFG_Timer;
284 struct tagSFG_Timer
285 {
286     SFG_Node        Node;
287     int             ID;                 /* The timer ID integer              */
288     FGCBtimer       Callback;           /* The timer callback                */
289     long            TriggerTime;        /* The timer trigger time            */
290 };
291
292 /*
293  * A window and its OpenGL context. The contents of this structure
294  * are highly dependant on the target operating system we aim at...
295  */
296 typedef struct tagSFG_Context SFG_Context;
297 struct tagSFG_Context
298 {
299 #if TARGET_HOST_UNIX_X11
300     Window          Handle;             /* The window's handle                 */
301     GLXContext      Context;            /* The OpenGL context                  */
302     XVisualInfo*    VisualInfo;         /* The window's visual information     */
303
304 #elif TARGET_HOST_WIN32
305     HWND            Handle;             /* The window's handle                 */
306     HDC             Device;             /* The window's device context         */
307     HGLRC           Context;            /* The window's WGL context            */
308
309 #endif
310
311     int             DoubleBuffered;     /* Treat the window as double-buffered */
312 };
313
314 /*
315  * Window's state description. This structure should be kept portable.
316  */
317 typedef struct tagSFG_WindowState SFG_WindowState;
318 struct tagSFG_WindowState
319 {
320     int             Width;              /* Window's width in pixels          */
321     int             Height;             /* The same about the height         */
322
323     GLboolean       Redisplay;          /* Do we have to redisplay?          */
324     GLboolean       Visible;            /* Is the window visible now         */
325
326     int             Cursor;             /* The currently selected cursor     */
327     int             Modifiers;          /* The current ALT/SHIFT/CTRL state  */
328
329     long            JoystickPollRate;   /* The joystick polling rate         */
330     long            JoystickLastPoll;   /* When the last poll has happened   */
331
332     int             MouseX, MouseY;     /* The most recent mouse position    */
333
334     GLboolean       IsGameMode;         /* Is this the game mode window?     */
335
336 #if TARGET_HOST_WIN32
337     GLboolean       NeedToResize;       /* Do we need to explicitly resize?  */
338 #endif
339 };
340
341 /*
342  * The window callbacks the user can supply us with. Should be kept portable.
343  */
344 typedef struct tagSFG_WindowCallbacks SFG_WindowCallbacks;
345 struct tagSFG_WindowCallbacks
346 {
347     /*
348      * Following callbacks are fully supported right now
349      * and are ready to be tested for GLUT conformance:
350      */
351     FGCBdisplay         Display;
352     FGCBreshape         Reshape;
353     FGCBkeyboard        Keyboard;
354     FGCBkeyboardUp      KeyboardUp;
355     FGCBspecial         Special;
356     FGCBspecialUp       SpecialUp;
357     FGCBmouse           Mouse;
358     FGCBmotion          Motion;
359     FGCBpassive         Passive;
360     FGCBentry           Entry;
361     FGCBvisibility      Visibility;
362     FGCBwindowStatus    WindowStatus;
363     FGCBjoystick        Joystick;
364     FGCBdestroy         Destroy;
365
366     /*
367      * Those callbacks are being ignored for the moment
368      */
369     FGCBselect          Select;
370     FGCBoverlayDisplay  OverlayDisplay;
371     FGCBspaceMotion     SpaceMotion;
372     FGCBspaceRotate     SpaceRotation;
373     FGCBspaceButton     SpaceButton;
374     FGCBdials           Dials;
375     FGCBbuttonBox       ButtonBox;
376     FGCBtabletMotion    TabletMotion;
377     FGCBtabletButton    TabletButton;
378 };
379
380 /*
381  * This structure describes a menu
382  */
383 typedef struct tagSFG_Menu SFG_Menu;
384 struct tagSFG_Menu
385 {
386     SFG_Node            Node;
387     void               *UserData ;              /* A. Donev:  User data passed back at callback */
388     int                 ID;                     /* The global menu ID        */
389     SFG_List            Entries;                /* The menu entries list     */
390     FGCBmenu            Callback;               /* The menu callback         */
391     FGCBdestroy         Destroy;                /* A. Donev:  Destruction callback         */
392     GLboolean           IsActive;               /* Is the menu selected?     */
393     int                 Width;                  /* Menu box width in pixels  */
394     int                 Height;                 /* Menu box height in pixels */
395     int                 X, Y;                   /* Menu box raster position  */
396 };
397
398 /*
399  * This is a menu entry
400  */
401 typedef struct tagSFG_MenuEntry SFG_MenuEntry;
402 struct tagSFG_MenuEntry
403 {
404     SFG_Node            Node;
405     int                 ID;                     /* The menu entry ID (local) */
406     int                 Ordinal;                /* The menu's ordinal number */
407     char*               Text;                   /* The text to be displayed  */
408     SFG_Menu*           SubMenu;                /* Optional sub-menu tree    */
409     GLboolean           IsActive;               /* Is the entry highlighted? */
410     int                 Width;                  /* Label's width in pixels   */
411 };
412
413 /*
414  * A window, making part of freeglut windows hierarchy. Should be kept portable.
415  */
416 typedef struct tagSFG_Window SFG_Window;
417 struct tagSFG_Window
418 {
419     SFG_Node            Node;
420     int                 ID;                     /* Window's ID number        */
421
422     SFG_Context         Window;                 /* Window and OpenGL context */
423     SFG_WindowState     State;                  /* The window state          */
424     SFG_WindowCallbacks Callbacks;              /* The window callbacks      */
425     void               *UserData ;              /* A. Donev:  A pointer to user data used in rendering */
426
427     SFG_Menu*       Menu[ FREEGLUT_MAX_MENUS ]; /* Menus appended to window  */
428     SFG_Menu*       ActiveMenu;                 /* The window's active menu  */
429
430     SFG_Window*         Parent;                 /* The parent to this window */
431     SFG_List            Children;               /* The subwindows d.l. list  */
432 };
433
434 /*
435  * A linked list structure of windows
436  */
437 typedef struct tagSFG_WindowList SFG_WindowList ;
438 struct tagSFG_WindowList
439 {
440   SFG_Window *window ;
441   GLboolean needToClose ;
442   SFG_WindowList *next ;
443 } ;
444
445 /*
446  * This holds information about all the windows, menus etc.
447  */
448 typedef struct tagSFG_Structure SFG_Structure;
449 struct tagSFG_Structure
450 {
451     SFG_List            Windows;                /* The global windows list   */
452     SFG_List            Menus;                  /* The global menus list     */
453
454     SFG_Window*         Window;                 /* The currently active win. */
455     SFG_Menu*           Menu;                   /* Same, but menu...         */
456
457     SFG_Window*         GameMode;               /* The game mode window      */
458
459     int                 WindowID;               /* The new current window ID */
460     int                 MenuID;                 /* The new current menu ID   */
461 };
462
463 /*
464  * This structure is used for the enumeration purposes.
465  * You can easily extend its functionalities by declaring
466  * a structure containing enumerator's contents and custom
467  * data, then casting its pointer to (SFG_Enumerator *).
468  */
469 typedef struct tagSFG_Enumerator SFG_Enumerator;
470 struct tagSFG_Enumerator
471 {
472     GLboolean   found;                          /* Used to terminate search  */
473     void*       data;                           /* Custom data pointer       */
474 };
475 typedef void (* FGCBenumerator  )( SFG_Window *, SFG_Enumerator * );
476
477 /*
478  * The bitmap font structure
479  */
480 typedef struct tagSFG_Font SFG_Font;
481 struct tagSFG_Font
482 {
483     char*           Name;                       /* The source font name      */
484     int             Quantity;                   /* Number of chars in font   */
485     int             Height;                     /* Height of the characters  */
486     const GLubyte** Characters;                 /* The characters mapping    */
487
488     float           xorig, yorig ;              /* The origin of the character relative to the draw location */
489 };
490
491 /*
492  * The stroke font structures
493  */
494
495 typedef struct tagSFG_StrokeVertex SFG_StrokeVertex;
496 struct tagSFG_StrokeVertex
497 {
498     GLfloat         X, Y;
499 };
500
501 typedef struct tagSFG_StrokeStrip SFG_StrokeStrip;
502 struct tagSFG_StrokeStrip
503 {
504     int             Number;
505     const SFG_StrokeVertex* Vertices;
506 };
507
508 typedef struct tagSFG_StrokeChar SFG_StrokeChar;
509 struct tagSFG_StrokeChar
510 {
511     GLfloat         Right;
512     int             Number;
513     const SFG_StrokeStrip* Strips;
514 };
515
516 typedef struct tagSFG_StrokeFont SFG_StrokeFont;
517 struct tagSFG_StrokeFont
518 {
519     char*           Name;                       /* The source font name      */
520     int             Quantity;                   /* Number of chars in font   */
521     GLfloat         Height;                     /* Height of the characters  */
522     const SFG_StrokeChar** Characters;          /* The characters mapping    */
523 };
524
525 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
526
527 /*
528  * Freeglut display related stuff (initialized once per session)
529  */
530 extern SFG_Display fgDisplay;
531
532 /*
533  * Freeglut internal structure
534  */
535 extern SFG_Structure fgStructure;
536
537 /*
538  * The current freeglut settings
539  */
540 extern SFG_State fgState;
541
542
543 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
544
545 /*
546  * A call to this function makes us sure that the Display and Structure
547  * subsystems have been properly initialized and are ready to be used
548  */
549 #define  freeglut_assert_ready                      assert( fgState.Time.Set );
550
551 /*
552  * Following definitions are somewhat similiar to GLib's,
553  * but do not generate any log messages:
554  */
555 #define  freeglut_return_if_fail( expr )            if( !(expr) ) return;
556 #define  freeglut_return_val_if_fail( expr, val )   if( !(expr) ) return( val );
557
558 /*
559  * A call to those macros assures us that there is a current
560  * window and menu set, respectively:
561  */
562 #define  freeglut_assert_window                     assert( fgStructure.Window != NULL );
563 #define  freeglut_assert_menu                       assert( fgStructure.Menu != NULL );
564
565 /*
566  * The initialize and deinitialize functions get called on glutInit()
567  * and glutMainLoop() end respectively. They should create/clean up
568  * everything inside of the freeglut
569  */
570 void fgInitialize( const char* displayName );
571 void fgDeinitialize( void );
572
573 /*
574  * Those two functions are used to create/destroy the freeglut internal
575  * structures. This actually happens when calling glutInit() and when
576  * quitting the glutMainLoop() (which actually happens, when all windows
577  * have been closed).
578  */
579 void fgCreateStructure( void );
580 void fgDestroyStructure( void );
581
582 /*
583  * A helper function to check if a display mode is possible to use
584  */
585 #if TARGET_HOST_UNIX_X11
586 XVisualInfo* fgChooseVisual( void );
587 #endif
588
589 /*
590  * The window procedure for Win32 events handling
591  */
592 #if TARGET_HOST_WIN32
593 LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
594 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned char layer_type );
595 #endif
596
597 /*
598  * Window creation, opening, closing and destruction.
599  * Defined in freeglut_structure.c, freeglut_window.c.
600  */
601 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, int x, int y, int w, int h, GLboolean gameMode );
602 void        fgSetWindow ( SFG_Window *window ) ;
603 void        fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, int isSubWindow );
604 void        fgCloseWindow( SFG_Window* window );
605 void        fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose ) ;
606 void        fgCloseWindows () ;
607 void        fgDestroyWindow( SFG_Window* window, GLboolean needToClose );
608
609 /*
610  * Menu creation and destruction. Defined in freeglut_structure.c
611  */
612 SFG_Menu*   fgCreateMenu( FGCBmenu menuCallback );
613 void        fgDestroyMenu( SFG_Menu* menu );
614
615 /*
616  * Joystick device management functions, defined in freeglut_joystick.c
617  */
618 void        fgJoystickInit( int ident );
619 void        fgJoystickClose( void );
620 void        fgJoystickPollWindow( SFG_Window* window );
621
622 /*
623  * Helper function to enumerate through all registered windows
624  * and one to enumerate all of a window's subwindows...
625  *
626  * The GFunc callback for those functions will be defined as:
627  *
628  *      void enumCallback( gpointer window, gpointer enumerator );
629  *
630  * where window is the enumerated (sub)window pointer (SFG_Window *),
631  * and userData is the a custom user-supplied pointer. Functions
632  * are defined and exported from freeglut_structure.c file.
633  */
634 void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator );
635 void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, SFG_Enumerator* enumerator );
636
637 /*
638  * fgWindowByHandle returns a (SFG_Window *) value pointing to the
639  * first window in the queue matching the specified window handle.
640  * The function is defined in freeglut_structure.c file.
641  */
642 #if TARGET_HOST_UNIX_X11
643     SFG_Window* fgWindowByHandle( Window hWindow );
644 #elif TARGET_HOST_WIN32
645
646     SFG_Window* fgWindowByHandle( HWND hWindow );
647 #endif
648
649 /*
650  * This function is similiar to the previous one, except it is
651  * looking for a specified (sub)window identifier. The function
652  * is defined in freeglut_structure.c file.
653  */
654 SFG_Window* fgWindowByID( int windowID );
655
656 /*
657  * Looks up a menu given its ID. This is easier that fgWindowByXXX
658  * as all menus are placed in a single doubly linked list...
659  */
660 SFG_Menu* fgMenuByID( int menuID );
661
662 /*
663  * The menu activation and deactivation the code. This is the meat
664  * of the menu user interface handling code...
665  */
666 void fgActivateMenu( SFG_Window* window, int button );
667 void fgExecuteMenuCallback( SFG_Menu* menu ) ;
668 GLboolean fgCheckActiveMenu ( SFG_Window *window, SFG_Menu *menu ) ;
669 void fgDeactivateMenu( SFG_Window *window );
670
671 /*
672  * This function gets called just before the buffers swap, so that
673  * freeglut can display the pull-down menus via OpenGL. The function
674  * is defined in freeglut_menu.c file.
675  */
676 void fgDisplayMenu( void );
677
678 /*
679  * Display the mouse cursor using OpenGL calls. The function
680  * is defined in freeglut_cursor.c file.
681  */
682 void fgDisplayCursor( void );
683
684 /*
685  * Elapsed time as per glutGet(GLUT_ELAPSED_TIME).
686  */
687 long fgElapsedTime( void );
688
689 /*
690  * List functions
691  */
692 void fgListInit(SFG_List *list);
693 void fgListAppend(SFG_List *list, SFG_Node *node);
694 void fgListRemove(SFG_List *list, SFG_Node *node);
695 int fgListLength(SFG_List *list);
696
697 /*
698  * Error Messages functions
699  */
700 void fgError( const char *fmt, ... );
701 void fgWarning( const char *fmt, ... );
702
703 #endif /* FREEGLUT_INTERNAL_H */
704
705 /*** END OF FILE ***/