MRPT  1.9.9
freeglut_internal.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #if HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15 
16 /* XXX Update these for each release! */
17 #define VERSION_MAJOR 2
18 #define VERSION_MINOR 4
19 #define VERSION_PATCH 0
20 
21 /* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */
22 #if defined(_WIN32_WCE)
23 #define TARGET_HOST_UNIX_X11 0
24 #define TARGET_HOST_WIN32 0
25 #define TARGET_HOST_WINCE 1
26 #elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
27 #define TARGET_HOST_UNIX_X11 0
28 #define TARGET_HOST_WIN32 1
29 #define TARGET_HOST_WINCE 0
30 #else
31 #define TARGET_HOST_UNIX_X11 1
32 #define TARGET_HOST_WIN32 0
33 #define TARGET_HOST_WINCE 0
34 #endif
35 
36 #define FREEGLUT_MAX_MENUS 3
37 
38 /* Somehow all Win32 include headers depend on this one: */
39 #if TARGET_HOST_WIN32
40 #include <windows.h>
41 
42 #include <TCHAR.H>
43 #include <mmsystem.h>
44 #include <windowsx.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 <math.h>
55 #include <stdio.h>
56 #include <stdlib.h>
57 #include <string.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/Xatom.h>
79 #include <X11/Xlib.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
178 {
183 
184 /* This structure holds different freeglut settings */
185 typedef struct tagSFG_State SFG_State;
187 {
188  SFG_XYUse Position; /* The default windows' position */
189  SFG_XYUse Size; /* The default windows' size */
190  unsigned int DisplayMode; /* Display mode for new windows */
191 
192  GLboolean Initialised; /* freeglut has been initialised */
193 
194  int DirectContext; /* Direct rendering state */
195 
196  GLboolean ForceIconic; /* New top windows are iconified */
197  GLboolean UseCurrentContext; /* New windows share with current */
198 
199  GLboolean GLDebugSwitch; /* OpenGL state debugging switch */
200  GLboolean XSyncSwitch; /* X11 sync protocol switch */
201 
202  int KeyRepeat; /* Global key repeat mode. */
203  int Modifiers; /* Current ALT/SHIFT/CTRL state */
204 
205  GLuint FPSInterval; /* Interval between FPS printfs */
206  GLuint SwapCount; /* Count of glutSwapBuffer calls */
207  GLuint SwapTime; /* Time of last SwapBuffers */
208 
209  SFG_Time Time; /* Time that glutInit was called */
210  SFG_List Timers; /* The freeglut timer hooks */
211  SFG_List FreeTimers; /* The unused timer hooks */
212 
213  FGCBIdle IdleCallback; /* The global idle callback */
214 
215  int ActiveMenus; /* Num. of currently active menus */
216  FGCBMenuState MenuStateCallback; /* Menu callbacks are global */
218 
219  SFG_XYUse GameModeSize; /* Game mode screen's dimensions */
220  int GameModeDepth; /* The pixel depth for game mode */
221  int GameModeRefresh; /* The refresh rate for game mode */
222 
223  int ActionOnWindowClose; /* Action when user closes window */
224 
225  fgExecutionState ExecState; /* Used for GLUT termination */
226  char* ProgramName; /* Name of the invoking program */
227  GLboolean
228  JoysticksInitialised; /* Only initialize if application calls for them
229  */
230 };
231 
232 /* The structure used by display initialization in freeglut_init.c */
235 {
236 #if TARGET_HOST_UNIX_X11
237  Display* Display; /* The display we are being run in. */
238  int Screen; /* The screen we are about to use. */
239  Window RootWindow; /* The screen's root window. */
240  int Connection; /* The display's connection number */
241  Atom DeleteWindow; /* The window deletion atom */
242 
243 #ifdef X_XF86VidModeGetModeLine
244  /*
245  * XF86VidMode may be compilable even if it fails at runtime. Therefore,
246  * the validity of the VidMode has to be tracked
247  */
248  int DisplayModeValid; /* Flag that indicates runtime status*/
249  XF86VidModeModeLine DisplayMode; /* Current screen's display settings */
250  int DisplayModeClock; /* The display mode's refresh rate */
251  int DisplayViewPortX; /* saved X location of the viewport */
252  int DisplayViewPortY; /* saved Y location of the viewport */
253  int DisplayPointerX; /* saved X location of the pointer */
254  int DisplayPointerY; /* saved Y location of the pointer */
255 
256 #endif
257 
258 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
259  HINSTANCE Instance; /* The application's instance */
260  DEVMODE DisplayMode; /* Desktop's display settings */
261 
262 #endif
263 
264  int ScreenWidth; /* The screen's width in pixels */
265  int ScreenHeight; /* The screen's height in pixels */
266  int ScreenWidthMM; /* The screen's width in milimeters */
267  int ScreenHeightMM; /* The screen's height in milimeters */
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  * A generic function pointer. We should really use the GLUTproc type
343  * defined in freeglut_ext.h, but if we include that header in this file
344  * a bunch of other stuff (font-related) blows up!
345  */
346 typedef void (*SFG_Proc)();
347 
348 /*
349  * SET_WCB() is used as:
350  *
351  * SET_WCB( window, cbname, func );
352  *
353  * ...where {window} is the freeglut window to set the callback,
354  * {cbname} is the window-specific callback to set,
355  * {func} is a function-pointer.
356  *
357  * Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
358  * but this can cause warnings because the FETCH_WCB() macro type-
359  * casts its result, and a type-cast value shouldn't be an lvalue.
360  *
361  * The {if( FETCH_WCB( ... ) != func )} test is to do type-checking
362  * and for no other reason. Since it's hidden in the macro, the
363  * ugliness is felt to be rather benign.
364  */
365 #define SET_WCB(window, cbname, func) \
366  do \
367  { \
368  if (FETCH_WCB(window, cbname) != (SFG_Proc)(func)) \
369  (((window).CallBacks[CB_##cbname]) = (SFG_Proc)(func)); \
370  } while (0)
371 
372 /*
373  * FETCH_WCB() is used as:
374  *
375  * FETCH_WCB( window, cbname );
376  *
377  * ...where {window} is the freeglut window to fetch the callback from,
378  * {cbname} is the window-specific callback to fetch.
379  *
380  * The result is correctly type-cast to the callback function pointer
381  * type.
382  */
383 #define FETCH_WCB(window, cbname) ((window).CallBacks[CB_##cbname])
384 
385 /*
386  * INVOKE_WCB() is used as:
387  *
388  * INVOKE_WCB( window, cbname, ( arg_list ) );
389  *
390  * ...where {window} is the freeglut window,
391  * {cbname} is the window-specific callback to be invoked,
392  * {(arg_list)} is the parameter list.
393  *
394  * The callback is invoked as:
395  *
396  * callback( arg_list );
397  *
398  * ...so the parentheses are REQUIRED in the {arg_list}.
399  *
400  * NOTE that it does a sanity-check and also sets the
401  * current window.
402  *
403  */
404 #if TARGET_HOST_WIN32
405 #define INVOKE_WCB(window, cbname, arg_list) \
406  do \
407  { \
408  if (FETCH_WCB(window, cbname)) \
409  { \
410  FGCB##cbname func = (FGCB##cbname)(FETCH_WCB(window, cbname)); \
411  fgSetWindow(&window); \
412  func arg_list; \
413  } \
414  } while (0)
415 #else
416 #define INVOKE_WCB(window, cbname, arg_list) \
417  do \
418  { \
419  if (FETCH_WCB(window, cbname)) \
420  { \
421  fgSetWindow(&window); \
422  ((FGCB##cbname)FETCH_WCB(window, cbname)) arg_list; \
423  } \
424  } while (0)
425 #endif
426 
427 /*
428  * The window callbacks the user can supply us with. Should be kept portable.
429  *
430  * This enumeration provides the freeglut CallBack numbers.
431  * The symbolic constants are indices into a window's array of
432  * function callbacks. The names are formed by splicing a common
433  * prefix onto the callback's base name. (This was originally
434  * done so that an early stage of development could live side-by-
435  * side with the old callback code. The old callback code used
436  * the bare callback's name as a structure member, so I used a
437  * prefix for the array index name.)
438  *
439  * XXX For consistancy, perhaps the prefix should match the
440  * XXX FETCH* and INVOKE* macro suffices. I.e., WCB_, rather than
441  * XXX CB_.
442  */
443 enum
444 {
460 
461  /* Presently ignored */
471 
472  /* Always make this the LAST one */
474 };
475 
476 /* This structure holds the OpenGL rendering context for all the menu windows */
479 {
480 #if TARGET_HOST_UNIX_X11
481  XVisualInfo* VisualInfo; /* The window's visual information */
482 #endif
483 
484  SFG_WindowContextType Context; /* The menu window's WGL context */
485 };
486 
487 /* This structure describes a menu */
488 typedef struct tagSFG_Window SFG_Window;
490 typedef struct tagSFG_Menu SFG_Menu;
492 {
494  void* UserData; /* User data passed back at callback */
495  int ID; /* The global menu ID */
496  SFG_List Entries; /* The menu entries list */
497  FGCBMenu Callback; /* The menu callback */
498  FGCBDestroy Destroy; /* Destruction callback */
499  GLboolean IsActive; /* Is the menu selected? */
500  int Width; /* Menu box width in pixels */
501  int Height; /* Menu box height in pixels */
502  int X, Y; /* Menu box raster position */
503 
504  SFG_MenuEntry* ActiveEntry; /* Currently active entry in the menu */
505  SFG_Window* Window; /* Window for menu */
506  SFG_Window* ParentWindow; /* Window in which the menu is invoked */
507 };
508 
509 /* This is a menu entry */
511 {
513  int ID; /* The menu entry ID (local) */
514  int Ordinal; /* The menu's ordinal number */
515  char* Text; /* The text to be displayed */
516  SFG_Menu* SubMenu; /* Optional sub-menu tree */
517  GLboolean IsActive; /* Is the entry highlighted? */
518  int Width; /* Label's width in pixels */
519 };
520 
521 /*
522  * A window, making part of freeglut windows hierarchy.
523  * Should be kept portable.
524  *
525  * NOTE that ActiveMenu is set to menu itself if the window is a menu.
526  */
528 {
530  int ID; /* Window's ID number */
531 
532  SFG_Context Window; /* Window and OpenGL context */
533  SFG_WindowState State; /* The window state */
534  SFG_Proc CallBacks[TOTAL_CALLBACKS]; /* Array of window callbacks */
535  void* UserData; /* For use by user */
536 
537  SFG_Menu* Menu[FREEGLUT_MAX_MENUS]; /* Menus appended to window */
538  SFG_Menu* ActiveMenu; /* The window's active menu */
539 
540  SFG_Window* Parent; /* The parent to this window */
541  SFG_List Children; /* The subwindows d.l. list */
542 
543  GLboolean IsMenu; /* Set to 1 if we are a menu */
544 };
545 
546 /* A linked list structure of windows */
549 {
552 };
553 
554 /* This holds information about all the windows, menus etc. */
557 {
558  SFG_List Windows; /* The global windows list */
559  SFG_List Menus; /* The global menus list */
561 
562  SFG_Window* CurrentWindow; /* The currently set window */
563  SFG_Menu* CurrentMenu; /* Same, but menu... */
564 
565  SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
566 
567  SFG_Window* GameMode; /* The game mode window */
568 
569  int WindowID; /* The new current window ID */
570  int MenuID; /* The new current menu ID */
571 };
572 
573 /*
574  * This structure is used for the enumeration purposes.
575  * You can easily extend its functionalities by declaring
576  * a structure containing enumerator's contents and custom
577  * data, then casting its pointer to (SFG_Enumerator *).
578  */
581 {
582  GLboolean found; /* Used to terminate search */
583  void* data; /* Custom data pointer */
584 };
586 
587 /* The bitmap font structure */
588 typedef struct tagSFG_Font SFG_Font;
590 {
591  char* Name; /* The source font name */
592  int Quantity; /* Number of chars in font */
593  int Height; /* Height of the characters */
594  const GLubyte** Characters; /* The characters mapping */
595 
596  float xorig, yorig; /* Relative origin of the character */
597 };
598 
599 /* The stroke font structures */
600 
603 {
605 };
606 
609 {
610  int Number;
612 };
613 
616 {
618  int Number;
620 };
621 
624 {
625  char* Name; /* The source font name */
626  int Quantity; /* Number of chars in font */
627  GLfloat Height; /* Height of the characters */
628  const SFG_StrokeChar** Characters; /* The characters mapping */
629 };
630 
631 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
632 
633 /* Freeglut display related stuff (initialized once per session) */
634 extern SFG_Display fgDisplay;
635 
636 /* Freeglut internal structure */
638 
639 /* The current freeglut settings */
640 extern SFG_State fgState;
641 
642 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
643 
644 /*
645  * A call to this function makes us sure that the Display and Structure
646  * subsystems have been properly initialized and are ready to be used
647  */
648 #define FREEGLUT_EXIT_IF_NOT_INITIALISED(string) \
649  if (!fgState.Initialised) \
650  { \
651  fgError( \
652  " ERROR: Function <%s> called" \
653  " without first calling 'glutInit'.", \
654  (string)); \
655  }
656 
657 #define FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED(string) \
658  if (!fgState.Initialised) \
659  { \
660  fgError( \
661  " ERROR: Internal <%s> function called" \
662  " without first calling 'glutInit'.", \
663  (string)); \
664  }
665 
666 #define FREEGLUT_INTERNAL_ERROR_EXIT(cond, string, function) \
667  if (!(cond)) \
668  { \
669  fgError( \
670  " ERROR: Internal error <%s> in function %s", (string), \
671  (function)); \
672  }
673 
674 /*
675  * Following definitions are somewhat similiar to GLib's,
676  * but do not generate any log messages:
677  */
678 #define freeglut_return_if_fail(expr) \
679  if (!(expr)) return;
680 #define freeglut_return_val_if_fail(expr, val) \
681  if (!(expr)) return val;
682 
683 /*
684  * A call to those macros assures us that there is a current
685  * window set, respectively:
686  */
687 #define FREEGLUT_EXIT_IF_NO_WINDOW(string) \
688  if (!fgStructure.CurrentWindow) \
689  { \
690  fgError( \
691  " ERROR: Function <%s> called" \
692  " with no current window defined.", \
693  (string)); \
694  }
695 
696 /*
697  * The deinitialize function gets called on glutMainLoop() end. It should clean
698  * 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
720  fgWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
721 GLboolean fgSetupPixelFormat(
722  SFG_Window* window, GLboolean checkOnly, 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  */
731  SFG_Window* parent, const char* title, int x, int y, int w, int h,
732  GLboolean gameMode, GLboolean isMenu);
733 void fgSetWindow(SFG_Window* window);
734 void fgOpenWindow(
735  SFG_Window* window, const char* title, int x, int y, int w, int h,
736  GLboolean gameMode, GLboolean isSubWindow);
737 void fgCloseWindow(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(
774  SFG_Window* window, FGCBenumerator enumCallback,
775  SFG_Enumerator* enumerator);
776 
777 /*
778  * fgWindowByHandle returns a (SFG_Window *) value pointing to the
779  * first window in the queue matching the specified window handle.
780  * The function is defined in freeglut_structure.c file.
781  */
783 
784 /*
785  * This function is similiar to the previous one, except it is
786  * looking for a specified (sub)window identifier. The function
787  * is defined in freeglut_structure.c file.
788  */
789 SFG_Window* fgWindowByID(int windowID);
790 
791 /*
792  * Looks up a menu given its ID. This is easier than fgWindowByXXX
793  * as all menus are placed in a single doubly linked list...
794  */
795 SFG_Menu* fgMenuByID(int menuID);
796 
797 /*
798  * The menu activation and deactivation the code. This is the meat
799  * of the menu user interface handling code...
800  */
801 void fgUpdateMenuHighlight(SFG_Menu* menu);
803  SFG_Window* window, int button, GLboolean pressed, int mouse_x,
804  int mouse_y);
805 void fgDeactivateMenu(SFG_Window* window);
806 
807 /*
808  * This function gets called just before the buffers swap, so that
809  * freeglut can display the pull-down menus via OpenGL. The function
810  * is defined in freeglut_menu.c file.
811  */
812 void fgDisplayMenu(void);
813 
814 /* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
815 long fgElapsedTime(void);
816 
817 /* List functions */
818 void fgListInit(SFG_List* list);
819 void fgListAppend(SFG_List* list, SFG_Node* node);
820 void fgListRemove(SFG_List* list, SFG_Node* node);
821 int fgListLength(SFG_List* list);
822 void fgListInsert(SFG_List* list, SFG_Node* next, SFG_Node* node);
823 
824 /* Error Message functions */
825 void fgError(const char* fmt, ...);
826 void fgWarning(const char* fmt, ...);
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(* FGCBMouse)(int, int, int, int)
GLboolean ForceIconic
int fgJoystickDetect(void)
unsigned int GLuint
Definition: glew.h:209
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:110
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:117
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:4199
float GLfloat
Definition: glew.h:218
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:3542
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:210
void fgCloseWindow(SFG_Window *window)
XVisualInfo * VisualInfo
void(* FGCBDestroy)(void)
GLenum GLint x
Definition: glext.h:3542
SFG_XYUse GameModeSize
unsigned char GLboolean
Definition: glew.h:212
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:215
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: 45d659fbb Tue Dec 10 18:21:14 2019 +0100 at mar dic 10 18:30:09 CET 2019