Main MRPT website > C++ reference for MRPT 1.5.6
freeglut_internal.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #ifndef FREEGLUT_INTERNAL_H
11 #define FREEGLUT_INTERNAL_H
12 
13 #if HAVE_CONFIG_H
14 # include "config.h"
15 #endif
16 
17 /* XXX Update these for each release! */
18 #define VERSION_MAJOR 2
19 #define VERSION_MINOR 4
20 #define VERSION_PATCH 0
21 
22 /* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */
23 #if defined(_WIN32_WCE)
24 # define TARGET_HOST_UNIX_X11 0
25 # define TARGET_HOST_WIN32 0
26 # define TARGET_HOST_WINCE 1
27 #elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
28 # define TARGET_HOST_UNIX_X11 0
29 # define TARGET_HOST_WIN32 1
30 # define TARGET_HOST_WINCE 0
31 #else
32 # define TARGET_HOST_UNIX_X11 1
33 # define TARGET_HOST_WIN32 0
34 # define TARGET_HOST_WINCE 0
35 #endif
36 
37 #define FREEGLUT_MAX_MENUS 3
38 
39 /* Somehow all Win32 include headers depend on this one: */
40 #if TARGET_HOST_WIN32
41 #include <windows.h>
42 #include <windowsx.h>
43 #include <mmsystem.h>
44 #include <TCHAR.H>
45 #endif
46 
47 #if defined(_MSC_VER)
48 #define strdup _strdup
49 #endif
50 
51 /* Those files should be available on every platform. */
52 #include <GL/gl.h>
53 #include <GL/glu.h>
54 #include <stdio.h>
55 #include <string.h>
56 #include <math.h>
57 #include <stdlib.h>
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 #if HAVE_UNISTD_H
62 # include <unistd.h>
63 #endif
64 #if TIME_WITH_SYS_TIME
65 # include <sys/time.h>
66 # include <time.h>
67 #else
68 # if HAVE_SYS_TIME_H
69 # include <sys/time.h>
70 # else
71 # include <time.h>
72 # endif
73 #endif
74 
75 /* The system-dependant include files should go here: */
76 #if TARGET_HOST_UNIX_X11
77  #include <GL/glx.h>
78  #include <X11/Xlib.h>
79  #include <X11/Xatom.h>
80  #include <X11/keysym.h>
81 
82  #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
83  #include <X11/extensions/xf86vmode.h>
84  #endif
85 #endif
86 
87 /* Microsoft VisualC++ 5.0's <math.h> does not define the PI */
88 #ifndef M_PI
89 # define M_PI 3.14159265358979323846
90 #endif
91 
92 #ifndef TRUE
93 # define TRUE 1
94 #endif
95 
96 #ifndef FALSE
97 # define FALSE 0
98 #endif
99 
100 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
101 
102 /* Freeglut callbacks type definitions */
103 typedef void (* FGCBDisplay )( void );
104 typedef void (* FGCBReshape )( int, int );
105 typedef void (* FGCBVisibility )( int );
106 typedef void (* FGCBKeyboard )( unsigned char, int, int );
107 typedef void (* FGCBSpecial )( int, int, int );
108 typedef void (* FGCBMouse )( int, int, int, int );
109 typedef void (* FGCBMouseWheel )( int, int, int, int );
110 typedef void (* FGCBMotion )( int, int );
111 typedef void (* FGCBPassive )( int, int );
112 typedef void (* FGCBEntry )( int );
113 typedef void (* FGCBWindowStatus )( int );
114 typedef void (* FGCBSelect )( int, int, int );
115 typedef void (* FGCBJoystick )( unsigned int, int, int, int );
116 typedef void (* FGCBKeyboardUp )( unsigned char, int, int );
117 typedef void (* FGCBSpecialUp )( int, int, int );
118 typedef void (* FGCBOverlayDisplay)( void );
119 typedef void (* FGCBSpaceMotion )( int, int, int );
120 typedef void (* FGCBSpaceRotation )( int, int, int );
121 typedef void (* FGCBSpaceButton )( int, int );
122 typedef void (* FGCBDials )( int, int );
123 typedef void (* FGCBButtonBox )( int, int );
124 typedef void (* FGCBTabletMotion )( int, int );
125 typedef void (* FGCBTabletButton )( int, int, int, int );
126 typedef void (* FGCBDestroy )( void );
127 
128 /* The global callbacks type definitions */
129 typedef void (* FGCBIdle )( void );
130 typedef void (* FGCBTimer )( int );
131 typedef void (* FGCBMenuState )( int );
132 typedef void (* FGCBMenuStatus )( int, int, int );
133 
134 /* The callback used when creating/using menus */
135 typedef void (* FGCBMenu )( int );
136 
137 
138 /* A list structure */
139 typedef struct tagSFG_List SFG_List;
141 {
142  void *First;
143  void *Last;
144 };
145 
146 /* A list node structure */
147 typedef struct tagSFG_Node SFG_Node;
149 {
150  void *Next;
151  void *Prev;
152 };
153 
154 /* A helper structure holding two ints and a boolean */
155 typedef struct tagSFG_XYUse SFG_XYUse;
157 {
158  GLint X, Y; /* The two integers... */
159  GLboolean Use; /* ...and a single boolean. */
160 };
161 
162 /* A helper structure holding a timeval and a boolean */
163 typedef struct tagSFG_Time SFG_Time;
165 {
166 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
167  DWORD Value;
168 #else
169  struct timeval Value;
170 #endif
172 };
173 
174 /*
175  * An enumeration containing the state of the GLUT execution:
176  * initializing, running, or stopping
177  */
178 typedef enum
179 {
184 
185 /* This structure holds different freeglut settings */
186 typedef struct tagSFG_State SFG_State;
188 {
189  SFG_XYUse Position; /* The default windows' position */
190  SFG_XYUse Size; /* The default windows' size */
191  unsigned int DisplayMode; /* Display mode for new windows */
192 
193  GLboolean Initialised; /* freeglut has been initialised */
194 
195  int DirectContext; /* Direct rendering state */
196 
197  GLboolean ForceIconic; /* New top windows are iconified */
198  GLboolean UseCurrentContext; /* New windows share with current */
199 
200  GLboolean GLDebugSwitch; /* OpenGL state debugging switch */
201  GLboolean XSyncSwitch; /* X11 sync protocol switch */
202 
203  int KeyRepeat; /* Global key repeat mode. */
204  int Modifiers; /* Current ALT/SHIFT/CTRL state */
205 
206  GLuint FPSInterval; /* Interval between FPS printfs */
207  GLuint SwapCount; /* Count of glutSwapBuffer calls */
208  GLuint SwapTime; /* Time of last SwapBuffers */
209 
210  SFG_Time Time; /* Time that glutInit was called */
211  SFG_List Timers; /* The freeglut timer hooks */
212  SFG_List FreeTimers; /* The unused timer hooks */
213 
214  FGCBIdle IdleCallback; /* The global idle callback */
215 
216  int ActiveMenus; /* Num. of currently active menus */
217  FGCBMenuState MenuStateCallback; /* Menu callbacks are global */
219 
220  SFG_XYUse GameModeSize; /* Game mode screen's dimensions */
221  int GameModeDepth; /* The pixel depth for game mode */
222  int GameModeRefresh; /* The refresh rate for game mode */
223 
224  int ActionOnWindowClose; /* Action when user closes window */
225 
226  fgExecutionState ExecState; /* Used for GLUT termination */
227  char *ProgramName; /* Name of the invoking program */
228  GLboolean JoysticksInitialised; /* Only initialize if application calls for them */
229 };
230 
231 /* The structure used by display initialization in freeglut_init.c */
234 {
235 #if TARGET_HOST_UNIX_X11
236  Display* Display; /* The display we are being run in. */
237  int Screen; /* The screen we are about to use. */
238  Window RootWindow; /* The screen's root window. */
239  int Connection; /* The display's connection number */
240  Atom DeleteWindow; /* The window deletion atom */
241 
242 #ifdef X_XF86VidModeGetModeLine
243  /*
244  * XF86VidMode may be compilable even if it fails at runtime. Therefore,
245  * the validity of the VidMode has to be tracked
246  */
247  int DisplayModeValid; /* Flag that indicates runtime status*/
248  XF86VidModeModeLine DisplayMode; /* Current screen's display settings */
249  int DisplayModeClock; /* The display mode's refresh rate */
250  int DisplayViewPortX; /* saved X location of the viewport */
251  int DisplayViewPortY; /* saved Y location of the viewport */
252  int DisplayPointerX; /* saved X location of the pointer */
253  int DisplayPointerY; /* saved Y location of the pointer */
254 
255 #endif
256 
257 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
258  HINSTANCE Instance; /* The application's instance */
259  DEVMODE DisplayMode; /* Desktop's display settings */
260 
261 #endif
262 
263  int ScreenWidth; /* The screen's width in pixels */
264  int ScreenHeight; /* The screen's height in pixels */
265  int ScreenWidthMM; /* The screen's width in milimeters */
266  int ScreenHeightMM; /* The screen's height in milimeters */
267 };
268 
269 
270 /* The user can create any number of timer hooks */
271 typedef struct tagSFG_Timer SFG_Timer;
273 {
275  int ID; /* The timer ID integer */
276  FGCBTimer Callback; /* The timer callback */
277  long TriggerTime; /* The timer trigger time */
278 };
279 
280 /*
281  * Make "freeglut" window handle and context types so that we don't need so
282  * much conditionally-compiled code later in the library.
283  */
284 #if TARGET_HOST_UNIX_X11
285 
286 typedef Window SFG_WindowHandleType ;
288 
289 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
290 
291 typedef HWND SFG_WindowHandleType ;
292 typedef HGLRC SFG_WindowContextType ;
293 
294 #endif
295 
296 /*
297  * A window and its OpenGL context. The contents of this structure
298  * are highly dependant on the target operating system we aim at...
299  */
302 {
303  SFG_WindowHandleType Handle; /* The window's handle */
304  SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
305 
306 #if TARGET_HOST_UNIX_X11
307  XVisualInfo* VisualInfo; /* The window's visual information */
308 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
309  HDC Device; /* The window's device context */
310 #endif
311 
312  int DoubleBuffered; /* Treat the window as double-buffered */
313 };
314 
315 /* Window's state description. This structure should be kept portable. */
318 {
319  int Width; /* Window's width in pixels */
320  int Height; /* The same about the height */
321  int OldWidth; /* Window width from before a resize */
322  int OldHeight; /* " height " " " " */
323 
324  GLboolean Redisplay; /* Do we have to redisplay? */
325  GLboolean Visible; /* Is the window visible now */
326 
327  int Cursor; /* The currently selected cursor */
328 
329  long JoystickPollRate; /* The joystick polling rate */
330  long JoystickLastPoll; /* When the last poll happened */
331 
332  int MouseX, MouseY; /* The most recent mouse position */
333 
334  GLboolean IgnoreKeyRepeat; /* Whether to ignore key repeat. */
335  GLboolean KeyRepeating; /* Currently in repeat mode */
336 
337  GLboolean IsGameMode; /* Is this the game mode window? */
338  GLboolean NeedToResize; /* Do we need to resize the window? */
339 };
340 
341 
342 /*
343  * A generic function pointer. We should really use the GLUTproc type
344  * defined in freeglut_ext.h, but if we include that header in this file
345  * a bunch of other stuff (font-related) blows up!
346  */
347 typedef void (*SFG_Proc)();
348 
349 
350 /*
351  * SET_WCB() is used as:
352  *
353  * SET_WCB( window, cbname, func );
354  *
355  * ...where {window} is the freeglut window to set the callback,
356  * {cbname} is the window-specific callback to set,
357  * {func} is a function-pointer.
358  *
359  * Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
360  * but this can cause warnings because the FETCH_WCB() macro type-
361  * casts its result, and a type-cast value shouldn't be an lvalue.
362  *
363  * The {if( FETCH_WCB( ... ) != func )} test is to do type-checking
364  * and for no other reason. Since it's hidden in the macro, the
365  * ugliness is felt to be rather benign.
366  */
367 #define SET_WCB(window,cbname,func) \
368 do \
369 { \
370  if( FETCH_WCB( window, cbname ) != (SFG_Proc)(func) ) \
371  (((window).CallBacks[CB_ ## cbname]) = (SFG_Proc)(func)); \
372 } while( 0 )
373 
374 /*
375  * FETCH_WCB() is used as:
376  *
377  * FETCH_WCB( window, cbname );
378  *
379  * ...where {window} is the freeglut window to fetch the callback from,
380  * {cbname} is the window-specific callback to fetch.
381  *
382  * The result is correctly type-cast to the callback function pointer
383  * type.
384  */
385 #define FETCH_WCB(window,cbname) \
386  ((window).CallBacks[CB_ ## cbname])
387 
388 /*
389  * INVOKE_WCB() is used as:
390  *
391  * INVOKE_WCB( window, cbname, ( arg_list ) );
392  *
393  * ...where {window} is the freeglut window,
394  * {cbname} is the window-specific callback to be invoked,
395  * {(arg_list)} is the parameter list.
396  *
397  * The callback is invoked as:
398  *
399  * callback( arg_list );
400  *
401  * ...so the parentheses are REQUIRED in the {arg_list}.
402  *
403  * NOTE that it does a sanity-check and also sets the
404  * current window.
405  *
406  */
407 #if TARGET_HOST_WIN32
408 #define INVOKE_WCB(window,cbname,arg_list) \
409 do \
410 { \
411  if( FETCH_WCB( window, cbname ) ) \
412  { \
413  FGCB ## cbname func = (FGCB ## cbname)(FETCH_WCB( window, cbname )); \
414  fgSetWindow( &window ); \
415  func arg_list; \
416  } \
417 } while( 0 )
418 #else
419 #define INVOKE_WCB(window,cbname,arg_list) \
420 do \
421 { \
422  if( FETCH_WCB( window, cbname ) ) \
423  { \
424  fgSetWindow( &window ); \
425  ((FGCB ## cbname)FETCH_WCB( window, cbname )) arg_list; \
426  } \
427 } while( 0 )
428 #endif
429 
430 /*
431  * The window callbacks the user can supply us with. Should be kept portable.
432  *
433  * This enumeration provides the freeglut CallBack numbers.
434  * The symbolic constants are indices into a window's array of
435  * function callbacks. The names are formed by splicing a common
436  * prefix onto the callback's base name. (This was originally
437  * done so that an early stage of development could live side-by-
438  * side with the old callback code. The old callback code used
439  * the bare callback's name as a structure member, so I used a
440  * prefix for the array index name.)
441  *
442  * XXX For consistancy, perhaps the prefix should match the
443  * XXX FETCH* and INVOKE* macro suffices. I.e., WCB_, rather than
444  * XXX CB_.
445  */
446 enum
447 {
463 
464  /* Presently ignored */
474 
475  /* Always make this the LAST one */
477 };
478 
479 
480 /* This structure holds the OpenGL rendering context for all the menu windows */
483 {
484 #if TARGET_HOST_UNIX_X11
485  XVisualInfo* VisualInfo; /* The window's visual information */
486 #endif
487 
488  SFG_WindowContextType Context; /* The menu window's WGL context */
489 };
490 
491 /* This structure describes a menu */
492 typedef struct tagSFG_Window SFG_Window;
494 typedef struct tagSFG_Menu SFG_Menu;
496 {
498  void *UserData; /* User data passed back at callback */
499  int ID; /* The global menu ID */
500  SFG_List Entries; /* The menu entries list */
501  FGCBMenu Callback; /* The menu callback */
502  FGCBDestroy Destroy; /* Destruction callback */
503  GLboolean IsActive; /* Is the menu selected? */
504  int Width; /* Menu box width in pixels */
505  int Height; /* Menu box height in pixels */
506  int X, Y; /* Menu box raster position */
507 
508  SFG_MenuEntry *ActiveEntry; /* Currently active entry in the menu */
509  SFG_Window *Window; /* Window for menu */
510  SFG_Window *ParentWindow; /* Window in which the menu is invoked */
511 };
512 
513 /* This is a menu entry */
515 {
517  int ID; /* The menu entry ID (local) */
518  int Ordinal; /* The menu's ordinal number */
519  char* Text; /* The text to be displayed */
520  SFG_Menu* SubMenu; /* Optional sub-menu tree */
521  GLboolean IsActive; /* Is the entry highlighted? */
522  int Width; /* Label's width in pixels */
523 };
524 
525 /*
526  * A window, making part of freeglut windows hierarchy.
527  * Should be kept portable.
528  *
529  * NOTE that ActiveMenu is set to menu itself if the window is a menu.
530  */
532 {
534  int ID; /* Window's ID number */
535 
536  SFG_Context Window; /* Window and OpenGL context */
537  SFG_WindowState State; /* The window state */
538  SFG_Proc CallBacks[ TOTAL_CALLBACKS ]; /* Array of window callbacks */
539  void *UserData ; /* For use by user */
540 
541  SFG_Menu* Menu[ FREEGLUT_MAX_MENUS ]; /* Menus appended to window */
542  SFG_Menu* ActiveMenu; /* The window's active menu */
543 
544  SFG_Window* Parent; /* The parent to this window */
545  SFG_List Children; /* The subwindows d.l. list */
546 
547  GLboolean IsMenu; /* Set to 1 if we are a menu */
548 };
549 
550 
551 /* A linked list structure of windows */
554 {
557 };
558 
559 /* This holds information about all the windows, menus etc. */
562 {
563  SFG_List Windows; /* The global windows list */
564  SFG_List Menus; /* The global menus list */
566 
567  SFG_Window* CurrentWindow; /* The currently set window */
568  SFG_Menu* CurrentMenu; /* Same, but menu... */
569 
570  SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
571 
572  SFG_Window* GameMode; /* The game mode window */
573 
574  int WindowID; /* The new current window ID */
575  int MenuID; /* The new current menu ID */
576 };
577 
578 /*
579  * This structure is used for the enumeration purposes.
580  * You can easily extend its functionalities by declaring
581  * a structure containing enumerator's contents and custom
582  * data, then casting its pointer to (SFG_Enumerator *).
583  */
586 {
587  GLboolean found; /* Used to terminate search */
588  void* data; /* Custom data pointer */
589 };
591 
592 /* The bitmap font structure */
593 typedef struct tagSFG_Font SFG_Font;
595 {
596  char* Name; /* The source font name */
597  int Quantity; /* Number of chars in font */
598  int Height; /* Height of the characters */
599  const GLubyte** Characters; /* The characters mapping */
600 
601  float xorig, yorig; /* Relative origin of the character */
602 };
603 
604 /* The stroke font structures */
605 
608 {
610 };
611 
614 {
615  int Number;
617 };
618 
621 {
623  int Number;
625 };
626 
629 {
630  char* Name; /* The source font name */
631  int Quantity; /* Number of chars in font */
632  GLfloat Height; /* Height of the characters */
633  const SFG_StrokeChar** Characters; /* The characters mapping */
634 };
635 
636 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
637 
638 /* Freeglut display related stuff (initialized once per session) */
639 extern SFG_Display fgDisplay;
640 
641 /* Freeglut internal structure */
643 
644 /* The current freeglut settings */
645 extern SFG_State fgState;
646 
647 
648 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
649 
650 /*
651  * A call to this function makes us sure that the Display and Structure
652  * subsystems have been properly initialized and are ready to be used
653  */
654 #define FREEGLUT_EXIT_IF_NOT_INITIALISED( string ) \
655  if ( ! fgState.Initialised ) \
656  { \
657  fgError ( " ERROR: Function <%s> called" \
658  " without first calling 'glutInit'.", (string) ) ; \
659  }
660 
661 #define FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED( string ) \
662  if ( ! fgState.Initialised ) \
663  { \
664  fgError ( " ERROR: Internal <%s> function called" \
665  " without first calling 'glutInit'.", (string) ) ; \
666  }
667 
668 #define FREEGLUT_INTERNAL_ERROR_EXIT( cond, string, function ) \
669  if ( ! ( cond ) ) \
670  { \
671  fgError ( " ERROR: Internal error <%s> in function %s", \
672  (string), (function) ) ; \
673  }
674 
675 /*
676  * Following definitions are somewhat similiar to GLib's,
677  * but do not generate any log messages:
678  */
679 #define freeglut_return_if_fail( expr ) \
680  if( !(expr) ) \
681  return;
682 #define freeglut_return_val_if_fail( expr, val ) \
683  if( !(expr) ) \
684  return val ;
685 
686 /*
687  * A call to those macros assures us that there is a current
688  * window set, respectively:
689  */
690 #define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \
691  if ( ! fgStructure.CurrentWindow ) \
692  { \
693  fgError ( " ERROR: Function <%s> called" \
694  " with no current window defined.", (string) ) ; \
695  }
696 
697 /*
698  * The deinitialize function gets called on glutMainLoop() end. It should clean up
699  * everything inside of the freeglut
700  */
701 void fgDeinitialize( void );
702 
703 /*
704  * Those two functions are used to create/destroy the freeglut internal
705  * structures. This actually happens when calling glutInit() and when
706  * quitting the glutMainLoop() (which actually happens, when all windows
707  * have been closed).
708  */
709 void fgCreateStructure( void );
710 void fgDestroyStructure( void );
711 
712 /* A helper function to check if a display mode is possible to use */
713 #if TARGET_HOST_UNIX_X11
714 XVisualInfo* fgChooseVisual( void );
715 #endif
716 
717 /* The window procedure for Win32 events handling */
718 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
719 LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
720  WPARAM wParam, LPARAM lParam );
721 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
722  unsigned char layer_type );
723 #endif
724 
725 /*
726  * Window creation, opening, closing and destruction.
727  * Also CallBack clearing/initialization.
728  * Defined in freeglut_structure.c, freeglut_window.c.
729  */
730 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
731  int x, int y, int w, int h,
732  GLboolean gameMode, GLboolean isMenu );
733 void fgSetWindow ( SFG_Window *window );
734 void fgOpenWindow( SFG_Window* window, const char* title,
735  int x, int y, int w, int h, GLboolean gameMode,
736  GLboolean isSubWindow );
737 void fgCloseWindow( SFG_Window* window );
738 void fgAddToWindowDestroyList ( SFG_Window* window );
739 void fgCloseWindows ();
740 void fgDestroyWindow( SFG_Window* window );
741 
742 /* Menu creation and destruction. Defined in freeglut_structure.c */
743 SFG_Menu* fgCreateMenu( FGCBMenu menuCallback );
744 void fgDestroyMenu( SFG_Menu* menu );
745 
746 /* Joystick device management functions, defined in freeglut_joystick.c */
747 int fgJoystickDetect( void );
748 void fgInitialiseJoysticks( void );
749 void fgJoystickClose( void );
750 void fgJoystickPollWindow( SFG_Window* window );
751 
752 /* More joystick functions. Should these go into the API? */
753 int glutJoystickGetNumAxes( int ident );
754 int glutJoystickGetNumButtons( int ident );
755 int glutJoystickNotWorking( int ident );
756 
757 /* Setting the cursor for a given window */
758 void fgSetCursor ( SFG_Window *window, int cursorID );
759 
760 /*
761  * Helper function to enumerate through all registered windows
762  * and one to enumerate all of a window's subwindows...
763  *
764  * The GFunc callback for those functions will be defined as:
765  *
766  * void enumCallback( gpointer window, gpointer enumerator );
767  *
768  * where window is the enumerated (sub)window pointer (SFG_Window *),
769  * and userData is the a custom user-supplied pointer. Functions
770  * are defined and exported from freeglut_structure.c file.
771  */
772 void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator );
773 void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback,
774  SFG_Enumerator* enumerator );
775 
776 /*
777  * fgWindowByHandle returns a (SFG_Window *) value pointing to the
778  * first window in the queue matching the specified window handle.
779  * The function is defined in freeglut_structure.c file.
780  */
782 
783 /*
784  * This function is similiar to the previous one, except it is
785  * looking for a specified (sub)window identifier. The function
786  * is defined in freeglut_structure.c file.
787  */
788 SFG_Window* fgWindowByID( int windowID );
789 
790 /*
791  * Looks up a menu given its ID. This is easier than fgWindowByXXX
792  * as all menus are placed in a single doubly linked list...
793  */
794 SFG_Menu* fgMenuByID( int menuID );
795 
796 /*
797  * The menu activation and deactivation the code. This is the meat
798  * of the menu user interface handling code...
799  */
800 void fgUpdateMenuHighlight ( SFG_Menu *menu );
801 GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
802  int mouse_x, int mouse_y );
803 void fgDeactivateMenu( SFG_Window *window );
804 
805 /*
806  * This function gets called just before the buffers swap, so that
807  * freeglut can display the pull-down menus via OpenGL. The function
808  * is defined in freeglut_menu.c file.
809  */
810 void fgDisplayMenu( void );
811 
812 /* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
813 long fgElapsedTime( void );
814 
815 /* List functions */
816 void fgListInit(SFG_List *list);
817 void fgListAppend(SFG_List *list, SFG_Node *node);
818 void fgListRemove(SFG_List *list, SFG_Node *node);
819 int fgListLength(SFG_List *list);
820 void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node);
821 
822 /* Error Message functions */
823 void fgError( const char *fmt, ... );
824 void fgWarning( const char *fmt, ... );
825 
826 #endif /* FREEGLUT_INTERNAL_H */
827 
828 /*** END OF FILE ***/
void fgEnumSubWindows(SFG_Window *window, FGCBenumerator enumCallback, SFG_Enumerator *enumerator)
SFG_Window * fgCreateWindow(SFG_Window *parent, const char *title, int x, int y, int w, int h, GLboolean gameMode, GLboolean isMenu)
void(* FGCBMenu)(int)
GLboolean ForceIconic
int fgJoystickDetect(void)
unsigned int GLuint
Definition: glew.h:204
fgExecutionState ExecState
GLboolean fgCheckActiveMenu(SFG_Window *window, int button, GLboolean pressed, int mouse_x, int mouse_y)
void(* FGCBOverlayDisplay)(void)
void(* FGCBTabletMotion)(int, int)
void fgDestroyWindow(SFG_Window *window)
void fgListAppend(SFG_List *list, SFG_Node *node)
unsigned int DisplayMode
#define FREEGLUT_MAX_MENUS
SFG_WindowContextType Context
long fgElapsedTime(void)
int Ordinal
GLboolean IsActive
void fgSetWindow(SFG_Window *window)
void(* FGCBDials)(int, int)
FGCBMenuState MenuStateCallback
void(* SFG_Proc)()
#define CALLBACK
Definition: glew.h:108
SFG_Window * Parent
const SFG_StrokeVertex * Vertices
struct __GLXcontextRec * GLXContext
Definition: glxew.h:116
int glutJoystickGetNumAxes(int ident)
Window SFG_WindowHandleType
void fgOpenWindow(SFG_Window *window, const char *title, int x, int y, int w, int h, GLboolean gameMode, GLboolean isSubWindow)
SFG_Menu * Menu[FREEGLUT_MAX_MENUS]
void(* FGCBMouseWheel)(int, int, int, int)
GLboolean XSyncSwitch
void(* FGCBMenuStatus)(int, int, int)
void(* FGCBEntry)(int)
GLboolean GLDebugSwitch
void(* FGCBJoystick)(unsigned int, int, int, int)
FGCBMenuStatus MenuStatusCallback
GLboolean JoysticksInitialised
int Width
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:3962
float GLfloat
Definition: glew.h:213
void(* FGCBDestroy)(void)
void fgCloseWindows()
void(* FGCBTabletButton)(int, int, int, int)
SFG_WindowContextType Context
SFG_MenuEntry * ActiveEntry
SFG_Menu * fgCreateMenu(FGCBMenu menuCallback)
void(* FGCBButtonBox)(int, int)
void fgJoystickPollWindow(SFG_Window *window)
SFG_Menu * fgMenuByID(int menuID)
FGCBDestroy Destroy
void fgDeactivateMenu(SFG_Window *window)
SFG_State fgState
char * Text
void fgError(const char *fmt,...)
fgExecutionState
SFG_Window * fgWindowByHandle(SFG_WindowHandleType hWindow)
FGCBTimer Callback
void fgDestroyMenu(SFG_Menu *menu)
int ID
SFG_Window * GameMode
GLboolean Initialised
void fgCreateStructure(void)
struct timeval Value
void(* FGCBVisibility)(int)
SFG_Window * ParentWindow
GLboolean IsActive
const GLubyte ** Characters
SFG_Menu * SubMenu
SFG_Node Node
XVisualInfo * VisualInfo
void(* FGCBTimer)(int)
void fgListInit(SFG_List *list)
const SFG_StrokeStrip * Strips
void(* FGCBDisplay)(void)
void(* FGCBKeyboard)(unsigned char, int, int)
SFG_XYUse Position
FGCBIdle IdleCallback
SFG_Proc CallBacks[TOTAL_CALLBACKS]
SFG_Menu * ActiveMenu
int fgListLength(SFG_List *list)
void(* FGCBenumerator)(SFG_Window *, SFG_Enumerator *)
void(* FGCBWindowStatus)(int)
void(* FGCBSpecial)(int, int, int)
SFG_Structure fgStructure
void(* FGCBMouse)(int, int, int, int)
void fgInitialiseJoysticks(void)
SFG_WindowHandleType Handle
GLXContext SFG_WindowContextType
void fgJoystickClose(void)
SFG_Window * fgWindowByID(int windowID)
XVisualInfo * fgChooseVisual(void)
void fgWarning(const char *fmt,...)
SFG_Window * CurrentWindow
GLboolean UseCurrentContext
SFG_MenuContext * MenuContext
void fgDestroyStructure(void)
void(* FGCBIdle)(void)
void fgAddToWindowDestroyList(SFG_Window *window)
void fgSetCursor(SFG_Window *window, int cursorID)
void(* FGCBSelect)(int, int, int)
void fgDeinitialize(void)
SFG_WindowState State
GLenum GLint GLint y
Definition: glext.h:3516
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
SFG_Window * Window
void fgDisplayMenu(void)
const SFG_StrokeChar ** Characters
int GLint
Definition: glew.h:205
void fgCloseWindow(SFG_Window *window)
XVisualInfo * VisualInfo
void(* FGCBPassive)(int, int)
GLenum GLint x
Definition: glext.h:3516
void(* FGCBKeyboardUp)(unsigned char, int, int)
void(* FGCBSpaceButton)(int, int)
void(* FGCBMenuState)(int)
void(* FGCBSpaceRotation)(int, int, int)
void(* FGCBSpaceMotion)(int, int, int)
SFG_XYUse GameModeSize
unsigned char GLboolean
Definition: glew.h:207
void(* FGCBSpecialUp)(int, int, int)
void fgListRemove(SFG_List *list, SFG_Node *node)
SFG_Context Window
int glutJoystickNotWorking(int ident)
unsigned char GLubyte
Definition: glew.h:210
void(* FGCBMotion)(int, int)
void(* FGCBReshape)(int, int)
void fgUpdateMenuHighlight(SFG_Menu *menu)
int glutJoystickGetNumButtons(int ident)
void fgEnumWindows(FGCBenumerator enumCallback, SFG_Enumerator *enumerator)
SFG_Display fgDisplay
void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node)



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019