MRPT  1.9.9
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-2018, 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);
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 /* A list structure */
138 typedef struct tagSFG_List SFG_List;
140 {
141  void* First;
142  void* Last;
143 };
144 
145 /* A list node structure */
146 typedef struct tagSFG_Node SFG_Node;
148 {
149  void* Next;
150  void* Prev;
151 };
152 
153 /* A helper structure holding two ints and a boolean */
154 typedef struct tagSFG_XYUse SFG_XYUse;
156 {
157  GLint X, Y; /* The two integers... */
158  GLboolean Use; /* ...and a single boolean. */
159 };
160 
161 /* A helper structure holding a timeval and a boolean */
162 typedef struct tagSFG_Time SFG_Time;
164 {
165 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
166  DWORD Value;
167 #else
168  struct timeval Value;
169 #endif
171 };
172 
173 /*
174  * An enumeration containing the state of the GLUT execution:
175  * initializing, running, or stopping
176  */
177 typedef enum {
182 
183 /* This structure holds different freeglut settings */
184 typedef struct tagSFG_State SFG_State;
186 {
187  SFG_XYUse Position; /* The default windows' position */
188  SFG_XYUse Size; /* The default windows' size */
189  unsigned int DisplayMode; /* Display mode for new windows */
190 
191  GLboolean Initialised; /* freeglut has been initialised */
192 
193  int DirectContext; /* Direct rendering state */
194 
195  GLboolean ForceIconic; /* New top windows are iconified */
196  GLboolean UseCurrentContext; /* New windows share with current */
197 
198  GLboolean GLDebugSwitch; /* OpenGL state debugging switch */
199  GLboolean XSyncSwitch; /* X11 sync protocol switch */
200 
201  int KeyRepeat; /* Global key repeat mode. */
202  int Modifiers; /* Current ALT/SHIFT/CTRL state */
203 
204  GLuint FPSInterval; /* Interval between FPS printfs */
205  GLuint SwapCount; /* Count of glutSwapBuffer calls */
206  GLuint SwapTime; /* Time of last SwapBuffers */
207 
208  SFG_Time Time; /* Time that glutInit was called */
209  SFG_List Timers; /* The freeglut timer hooks */
210  SFG_List FreeTimers; /* The unused timer hooks */
211 
212  FGCBIdle IdleCallback; /* The global idle callback */
213 
214  int ActiveMenus; /* Num. of currently active menus */
215  FGCBMenuState MenuStateCallback; /* Menu callbacks are global */
217 
218  SFG_XYUse GameModeSize; /* Game mode screen's dimensions */
219  int GameModeDepth; /* The pixel depth for game mode */
220  int GameModeRefresh; /* The refresh rate for game mode */
221 
222  int ActionOnWindowClose; /* Action when user closes window */
223 
224  fgExecutionState ExecState; /* Used for GLUT termination */
225  char* ProgramName; /* Name of the invoking program */
226  GLboolean
227  JoysticksInitialised; /* Only initialize if application calls for them
228  */
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 /* The user can create any number of timer hooks */
270 typedef struct tagSFG_Timer SFG_Timer;
272 {
274  int ID; /* The timer ID integer */
275  FGCBTimer Callback; /* The timer callback */
276  long TriggerTime; /* The timer trigger time */
277 };
278 
279 /*
280  * Make "freeglut" window handle and context types so that we don't need so
281  * much conditionally-compiled code later in the library.
282  */
283 #if TARGET_HOST_UNIX_X11
284 
285 typedef Window SFG_WindowHandleType;
287 
288 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
289 
290 typedef HWND SFG_WindowHandleType;
291 typedef HGLRC SFG_WindowContextType;
292 
293 #endif
294 
295 /*
296  * A window and its OpenGL context. The contents of this structure
297  * are highly dependant on the target operating system we aim at...
298  */
301 {
302  SFG_WindowHandleType Handle; /* The window's handle */
303  SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
304 
305 #if TARGET_HOST_UNIX_X11
306  XVisualInfo* VisualInfo; /* The window's visual information */
307 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
308  HDC Device; /* The window's device context */
309 #endif
310 
311  int DoubleBuffered; /* Treat the window as double-buffered */
312 };
313 
314 /* Window's state description. This structure should be kept portable. */
317 {
318  int Width; /* Window's width in pixels */
319  int Height; /* The same about the height */
320  int OldWidth; /* Window width from before a resize */
321  int OldHeight; /* " 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 
328  long JoystickPollRate; /* The joystick polling rate */
329  long JoystickLastPoll; /* When the last poll happened */
330 
331  int MouseX, MouseY; /* The most recent mouse position */
332 
333  GLboolean IgnoreKeyRepeat; /* Whether to ignore key repeat. */
334  GLboolean KeyRepeating; /* Currently in repeat mode */
335 
336  GLboolean IsGameMode; /* Is this the game mode window? */
337  GLboolean NeedToResize; /* Do we need to resize the window? */
338 };
339 
340 /*
341  * A generic function pointer. We should really use the GLUTproc type
342  * defined in freeglut_ext.h, but if we include that header in this file
343  * a bunch of other stuff (font-related) blows up!
344  */
345 typedef void (*SFG_Proc)();
346 
347 /*
348  * SET_WCB() is used as:
349  *
350  * SET_WCB( window, cbname, func );
351  *
352  * ...where {window} is the freeglut window to set the callback,
353  * {cbname} is the window-specific callback to set,
354  * {func} is a function-pointer.
355  *
356  * Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
357  * but this can cause warnings because the FETCH_WCB() macro type-
358  * casts its result, and a type-cast value shouldn't be an lvalue.
359  *
360  * The {if( FETCH_WCB( ... ) != func )} test is to do type-checking
361  * and for no other reason. Since it's hidden in the macro, the
362  * ugliness is felt to be rather benign.
363  */
364 #define SET_WCB(window, cbname, func) \
365  do \
366  { \
367  if (FETCH_WCB(window, cbname) != (SFG_Proc)(func)) \
368  (((window).CallBacks[CB_##cbname]) = (SFG_Proc)(func)); \
369  } while (0)
370 
371 /*
372  * FETCH_WCB() is used as:
373  *
374  * FETCH_WCB( window, cbname );
375  *
376  * ...where {window} is the freeglut window to fetch the callback from,
377  * {cbname} is the window-specific callback to fetch.
378  *
379  * The result is correctly type-cast to the callback function pointer
380  * type.
381  */
382 #define FETCH_WCB(window, cbname) ((window).CallBacks[CB_##cbname])
383 
384 /*
385  * INVOKE_WCB() is used as:
386  *
387  * INVOKE_WCB( window, cbname, ( arg_list ) );
388  *
389  * ...where {window} is the freeglut window,
390  * {cbname} is the window-specific callback to be invoked,
391  * {(arg_list)} is the parameter list.
392  *
393  * The callback is invoked as:
394  *
395  * callback( arg_list );
396  *
397  * ...so the parentheses are REQUIRED in the {arg_list}.
398  *
399  * NOTE that it does a sanity-check and also sets the
400  * current window.
401  *
402  */
403 #if TARGET_HOST_WIN32
404 #define INVOKE_WCB(window, cbname, arg_list) \
405  do \
406  { \
407  if (FETCH_WCB(window, cbname)) \
408  { \
409  FGCB##cbname func = (FGCB##cbname)(FETCH_WCB(window, cbname)); \
410  fgSetWindow(&window); \
411  func arg_list; \
412  } \
413  } while (0)
414 #else
415 #define INVOKE_WCB(window, cbname, arg_list) \
416  do \
417  { \
418  if (FETCH_WCB(window, cbname)) \
419  { \
420  fgSetWindow(&window); \
421  ((FGCB##cbname)FETCH_WCB(window, cbname)) arg_list; \
422  } \
423  } while (0)
424 #endif
425 
426 /*
427  * The window callbacks the user can supply us with. Should be kept portable.
428  *
429  * This enumeration provides the freeglut CallBack numbers.
430  * The symbolic constants are indices into a window's array of
431  * function callbacks. The names are formed by splicing a common
432  * prefix onto the callback's base name. (This was originally
433  * done so that an early stage of development could live side-by-
434  * side with the old callback code. The old callback code used
435  * the bare callback's name as a structure member, so I used a
436  * prefix for the array index name.)
437  *
438  * XXX For consistancy, perhaps the prefix should match the
439  * XXX FETCH* and INVOKE* macro suffices. I.e., WCB_, rather than
440  * XXX CB_.
441  */
442 enum
443 {
459 
460  /* Presently ignored */
470 
471  /* Always make this the LAST one */
473 };
474 
475 /* This structure holds the OpenGL rendering context for all the menu windows */
478 {
479 #if TARGET_HOST_UNIX_X11
480  XVisualInfo* VisualInfo; /* The window's visual information */
481 #endif
482 
483  SFG_WindowContextType Context; /* The menu window's WGL context */
484 };
485 
486 /* This structure describes a menu */
487 typedef struct tagSFG_Window SFG_Window;
489 typedef struct tagSFG_Menu SFG_Menu;
491 {
493  void* UserData; /* User data passed back at callback */
494  int ID; /* The global menu ID */
495  SFG_List Entries; /* The menu entries list */
496  FGCBMenu Callback; /* The menu callback */
497  FGCBDestroy Destroy; /* Destruction callback */
498  GLboolean IsActive; /* Is the menu selected? */
499  int Width; /* Menu box width in pixels */
500  int Height; /* Menu box height in pixels */
501  int X, Y; /* Menu box raster position */
502 
503  SFG_MenuEntry* ActiveEntry; /* Currently active entry in the menu */
504  SFG_Window* Window; /* Window for menu */
505  SFG_Window* ParentWindow; /* Window in which the menu is invoked */
506 };
507 
508 /* This is a menu entry */
510 {
512  int ID; /* The menu entry ID (local) */
513  int Ordinal; /* The menu's ordinal number */
514  char* Text; /* The text to be displayed */
515  SFG_Menu* SubMenu; /* Optional sub-menu tree */
516  GLboolean IsActive; /* Is the entry highlighted? */
517  int Width; /* Label's width in pixels */
518 };
519 
520 /*
521  * A window, making part of freeglut windows hierarchy.
522  * Should be kept portable.
523  *
524  * NOTE that ActiveMenu is set to menu itself if the window is a menu.
525  */
527 {
529  int ID; /* Window's ID number */
530 
531  SFG_Context Window; /* Window and OpenGL context */
532  SFG_WindowState State; /* The window state */
533  SFG_Proc CallBacks[TOTAL_CALLBACKS]; /* Array of window callbacks */
534  void* UserData; /* For use by user */
535 
536  SFG_Menu* Menu[FREEGLUT_MAX_MENUS]; /* Menus appended to window */
537  SFG_Menu* ActiveMenu; /* The window's active menu */
538 
539  SFG_Window* Parent; /* The parent to this window */
540  SFG_List Children; /* The subwindows d.l. list */
541 
542  GLboolean IsMenu; /* Set to 1 if we are a menu */
543 };
544 
545 /* A linked list structure of windows */
548 {
551 };
552 
553 /* This holds information about all the windows, menus etc. */
556 {
557  SFG_List Windows; /* The global windows list */
558  SFG_List Menus; /* The global menus list */
560 
561  SFG_Window* CurrentWindow; /* The currently set window */
562  SFG_Menu* CurrentMenu; /* Same, but menu... */
563 
564  SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
565 
566  SFG_Window* GameMode; /* The game mode window */
567 
568  int WindowID; /* The new current window ID */
569  int MenuID; /* The new current menu ID */
570 };
571 
572 /*
573  * This structure is used for the enumeration purposes.
574  * You can easily extend its functionalities by declaring
575  * a structure containing enumerator's contents and custom
576  * data, then casting its pointer to (SFG_Enumerator *).
577  */
580 {
581  GLboolean found; /* Used to terminate search */
582  void* data; /* Custom data pointer */
583 };
585 
586 /* The bitmap font structure */
587 typedef struct tagSFG_Font SFG_Font;
589 {
590  char* Name; /* The source font name */
591  int Quantity; /* Number of chars in font */
592  int Height; /* Height of the characters */
593  const GLubyte** Characters; /* The characters mapping */
594 
595  float xorig, yorig; /* Relative origin of the character */
596 };
597 
598 /* The stroke font structures */
599 
602 {
604 };
605 
608 {
609  int Number;
611 };
612 
615 {
617  int Number;
619 };
620 
623 {
624  char* Name; /* The source font name */
625  int Quantity; /* Number of chars in font */
626  GLfloat Height; /* Height of the characters */
627  const SFG_StrokeChar** Characters; /* The characters mapping */
628 };
629 
630 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
631 
632 /* Freeglut display related stuff (initialized once per session) */
633 extern SFG_Display fgDisplay;
634 
635 /* Freeglut internal structure */
637 
638 /* The current freeglut settings */
639 extern SFG_State fgState;
640 
641 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
642 
643 /*
644  * A call to this function makes us sure that the Display and Structure
645  * subsystems have been properly initialized and are ready to be used
646  */
647 #define FREEGLUT_EXIT_IF_NOT_INITIALISED(string) \
648  if (!fgState.Initialised) \
649  { \
650  fgError( \
651  " ERROR: Function <%s> called" \
652  " without first calling 'glutInit'.", \
653  (string)); \
654  }
655 
656 #define FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED(string) \
657  if (!fgState.Initialised) \
658  { \
659  fgError( \
660  " ERROR: Internal <%s> function called" \
661  " without first calling 'glutInit'.", \
662  (string)); \
663  }
664 
665 #define FREEGLUT_INTERNAL_ERROR_EXIT(cond, string, function) \
666  if (!(cond)) \
667  { \
668  fgError( \
669  " ERROR: Internal error <%s> in function %s", (string), \
670  (function)); \
671  }
672 
673 /*
674  * Following definitions are somewhat similiar to GLib's,
675  * but do not generate any log messages:
676  */
677 #define freeglut_return_if_fail(expr) \
678  if (!(expr)) return;
679 #define freeglut_return_val_if_fail(expr, val) \
680  if (!(expr)) return val;
681 
682 /*
683  * A call to those macros assures us that there is a current
684  * window set, respectively:
685  */
686 #define FREEGLUT_EXIT_IF_NO_WINDOW(string) \
687  if (!fgStructure.CurrentWindow) \
688  { \
689  fgError( \
690  " ERROR: Function <%s> called" \
691  " with no current window defined.", \
692  (string)); \
693  }
694 
695 /*
696  * The deinitialize function gets called on glutMainLoop() end. It should clean
697  * up
698  * everything inside of the freeglut
699  */
700 void fgDeinitialize(void);
701 
702 /*
703  * Those two functions are used to create/destroy the freeglut internal
704  * structures. This actually happens when calling glutInit() and when
705  * quitting the glutMainLoop() (which actually happens, when all windows
706  * have been closed).
707  */
708 void fgCreateStructure(void);
709 void fgDestroyStructure(void);
710 
711 /* A helper function to check if a display mode is possible to use */
712 #if TARGET_HOST_UNIX_X11
713 XVisualInfo* fgChooseVisual(void);
714 #endif
715 
716 /* The window procedure for Win32 events handling */
717 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
718 LRESULT CALLBACK
719  fgWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
720 GLboolean fgSetupPixelFormat(
721  SFG_Window* window, GLboolean checkOnly, unsigned char layer_type);
722 #endif
723 
724 /*
725  * Window creation, opening, closing and destruction.
726  * Also CallBack clearing/initialization.
727  * Defined in freeglut_structure.c, freeglut_window.c.
728  */
730  SFG_Window* parent, const char* title, int x, int y, int w, int h,
731  GLboolean gameMode, GLboolean isMenu);
732 void fgSetWindow(SFG_Window* window);
733 void fgOpenWindow(
734  SFG_Window* window, const char* title, int x, int y, int w, int h,
735  GLboolean gameMode, GLboolean isSubWindow);
736 void fgCloseWindow(SFG_Window* window);
738 void fgCloseWindows();
739 void fgDestroyWindow(SFG_Window* window);
740 
741 /* Menu creation and destruction. Defined in freeglut_structure.c */
742 SFG_Menu* fgCreateMenu(FGCBMenu menuCallback);
743 void fgDestroyMenu(SFG_Menu* menu);
744 
745 /* Joystick device management functions, defined in freeglut_joystick.c */
746 int fgJoystickDetect(void);
747 void fgInitialiseJoysticks(void);
748 void fgJoystickClose(void);
749 void fgJoystickPollWindow(SFG_Window* window);
750 
751 /* More joystick functions. Should these go into the API? */
752 int glutJoystickGetNumAxes(int ident);
753 int glutJoystickGetNumButtons(int ident);
754 int glutJoystickNotWorking(int ident);
755 
756 /* Setting the cursor for a given window */
757 void fgSetCursor(SFG_Window* window, int cursorID);
758 
759 /*
760  * Helper function to enumerate through all registered windows
761  * and one to enumerate all of a window's subwindows...
762  *
763  * The GFunc callback for those functions will be defined as:
764  *
765  * void enumCallback( gpointer window, gpointer enumerator );
766  *
767  * where window is the enumerated (sub)window pointer (SFG_Window *),
768  * and userData is the a custom user-supplied pointer. Functions
769  * are defined and exported from freeglut_structure.c file.
770  */
771 void fgEnumWindows(FGCBenumerator enumCallback, SFG_Enumerator* enumerator);
772 void fgEnumSubWindows(
773  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);
802  SFG_Window* window, int button, GLboolean pressed, int mouse_x,
803  int mouse_y);
804 void fgDeactivateMenu(SFG_Window* window);
805 
806 /*
807  * This function gets called just before the buffers swap, so that
808  * freeglut can display the pull-down menus via OpenGL. The function
809  * is defined in freeglut_menu.c file.
810  */
811 void fgDisplayMenu(void);
812 
813 /* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
814 long fgElapsedTime(void);
815 
816 /* List functions */
817 void fgListInit(SFG_List* list);
818 void fgListAppend(SFG_List* list, SFG_Node* node);
819 void fgListRemove(SFG_List* list, SFG_Node* node);
820 int fgListLength(SFG_List* list);
821 void fgListInsert(SFG_List* list, SFG_Node* next, SFG_Node* node);
822 
823 /* Error Message functions */
824 void fgError(const char* fmt, ...);
825 void fgWarning(const char* fmt, ...);
826 
827 #endif /* FREEGLUT_INTERNAL_H */
828 
829 /*** 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(* FGCBMouse)(int, int, int, int)
GLboolean ForceIconic
int fgJoystickDetect(void)
unsigned int GLuint
Definition: glew.h:208
fgExecutionState ExecState
GLboolean fgCheckActiveMenu(SFG_Window *window, int button, GLboolean pressed, int mouse_x, int mouse_y)
void(* FGCBButtonBox)(int, int)
void fgDestroyWindow(SFG_Window *window)
void fgListAppend(SFG_List *list, SFG_Node *node)
void(* FGCBOverlayDisplay)(void)
unsigned int DisplayMode
#define FREEGLUT_MAX_MENUS
SFG_WindowContextType Context
long fgElapsedTime(void)
void(* FGCBJoystick)(unsigned int, int, int, int)
int Ordinal
GLboolean IsActive
void(* FGCBWindowStatus)(int)
void fgSetWindow(SFG_Window *window)
FGCBMenuState MenuStateCallback
void(* SFG_Proc)()
#define CALLBACK
Definition: glew.h:111
SFG_Window * Parent
void(* FGCBenumerator)(SFG_Window *, SFG_Enumerator *)
const SFG_StrokeVertex * Vertices
void(* FGCBMouseWheel)(int, int, int, int)
void(* FGCBIdle)(void)
void(* FGCBMenuStatus)(int, int, int)
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]
GLboolean XSyncSwitch
void(* FGCBSpaceMotion)(int, int, int)
GLboolean GLDebugSwitch
void(* FGCBEntry)(int)
FGCBMenuStatus MenuStatusCallback
GLboolean JoysticksInitialised
void(* FGCBSpaceRotation)(int, int, int)
int Width
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
float GLfloat
Definition: glew.h:217
void fgCloseWindows()
void(* FGCBPassive)(int, int)
SFG_WindowContextType Context
SFG_MenuEntry * ActiveEntry
void(* FGCBVisibility)(int)
SFG_Menu * fgCreateMenu(FGCBMenu menuCallback)
void(* FGCBSpecial)(int, int, int)
void fgJoystickPollWindow(SFG_Window *window)
SFG_Menu * fgMenuByID(int menuID)
FGCBDestroy Destroy
void(* FGCBDisplay)(void)
void fgDeactivateMenu(SFG_Window *window)
SFG_State fgState
char * Text
void fgError(const char *fmt,...)
fgExecutionState
void(* FGCBDials)(int, int)
void(* FGCBTabletButton)(int, int, int, int)
SFG_Window * fgWindowByHandle(SFG_WindowHandleType hWindow)
FGCBTimer Callback
void fgDestroyMenu(SFG_Menu *menu)
void(* FGCBTabletMotion)(int, int)
int ID
SFG_Window * GameMode
void(* FGCBSpecialUp)(int, int, int)
void(* FGCBMotion)(int, int)
GLboolean Initialised
void(* FGCBKeyboard)(unsigned char, int, int)
void fgCreateStructure(void)
struct timeval Value
void(* FGCBSpaceButton)(int, int)
SFG_Window * ParentWindow
GLboolean IsActive
const GLubyte ** Characters
SFG_Menu * SubMenu
SFG_Node Node
XVisualInfo * VisualInfo
void fgListInit(SFG_List *list)
const SFG_StrokeStrip * Strips
SFG_XYUse Position
FGCBIdle IdleCallback
void(* FGCBTimer)(int)
SFG_Proc CallBacks[TOTAL_CALLBACKS]
SFG_Menu * ActiveMenu
int fgListLength(SFG_List *list)
SFG_Structure fgStructure
void fgInitialiseJoysticks(void)
SFG_WindowHandleType Handle
GLXContext SFG_WindowContextType
void fgJoystickClose(void)
SFG_Window * fgWindowByID(int windowID)
XVisualInfo * fgChooseVisual(void)
void(* FGCBSelect)(int, int, int)
void fgWarning(const char *fmt,...)
SFG_Window * CurrentWindow
GLboolean UseCurrentContext
SFG_MenuContext * MenuContext
void fgDestroyStructure(void)
void fgAddToWindowDestroyList(SFG_Window *window)
void fgSetCursor(SFG_Window *window, int cursorID)
void fgDeinitialize(void)
void(* FGCBMenuState)(int)
SFG_WindowState State
GLenum GLint GLint y
Definition: glext.h:3538
void(* FGCBReshape)(int, int)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
SFG_Window * Window
void fgDisplayMenu(void)
const SFG_StrokeChar ** Characters
int GLint
Definition: glew.h:209
void fgCloseWindow(SFG_Window *window)
XVisualInfo * VisualInfo
void(* FGCBDestroy)(void)
GLenum GLint x
Definition: glext.h:3538
SFG_XYUse GameModeSize
unsigned char GLboolean
Definition: glew.h:211
void(* FGCBMenu)(int)
void fgListRemove(SFG_List *list, SFG_Node *node)
SFG_Context Window
int glutJoystickNotWorking(int ident)
void(* FGCBKeyboardUp)(unsigned char, int, int)
unsigned char GLubyte
Definition: glew.h:214
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.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020