Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

glutint.h

Go to the documentation of this file.
00001 #ifndef __glutint_h__
00002 #define __glutint_h__
00003 
00004 /* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
00005 
00006 /* This program is freely distributable without licensing fees 
00007    and is provided without guarantee or warrantee expressed or 
00008    implied. This program is -not- in the public domain. */
00009 
00010 #if defined(__CYGWIN32__)
00011 #include <sys/time.h>
00012 #endif
00013 
00014 #if defined(_WIN32)
00015 #include "glutwin32.h"
00016 #else
00017 #ifdef __sgi
00018 #define SUPPORT_FORTRAN
00019 #endif
00020 #include <X11/Xlib.h>
00021 #include <X11/Xutil.h>
00022 #include <GL/glx.h>
00023 #endif
00024 
00025 #include "glutwacom.h"
00026 
00027 /* Non-Win32 platforms need APIENTRY defined to nothing
00028    because all the GLUT routines have the APIENTRY prefix
00029    to make Win32 happy. */
00030 #ifndef APIENTRY
00031 #define APIENTRY
00032 #endif
00033 
00034 #ifdef __vms
00035 #if ( __VMS_VER < 70000000 )
00036 struct timeval {
00037   __int64 val;
00038 };
00039 extern int sys$gettim(struct timeval *);
00040 #else
00041 #include <time.h>
00042 #endif
00043 #else
00044 #include <sys/types.h>
00045 #if !defined(_WIN32)
00046 #include <sys/time.h>
00047 #else
00048 #include <winsock.h>
00049 #endif
00050 #endif
00051 #if defined(__vms) && ( __VMS_VER < 70000000 )
00052 
00053 /* For VMS6.2 or lower :
00054    One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
00055    0.0001 milliseconds. This means that there are 0.01
00056    ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
00057    ticks/second. */
00058 
00059 #define TICKS_PER_MILLISECOND 10000
00060 #define TICKS_PER_SECOND      10000000
00061 
00062 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
00063 
00064 #define ADD_TIME(dest, src1, src2) { \
00065   (dest).val = (src1).val + (src2).val; \
00066 }
00067 
00068 #define TIMEDELTA(dest, src1, src2) { \
00069   (dest).val = (src1).val - (src2).val; \
00070 }
00071 
00072 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
00073 
00074 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
00075 
00076 #else
00077 #if defined(SVR4) && !defined(sun)  /* Sun claims SVR4, but
00078                                        wants 2 args. */
00079 #define GETTIMEOFDAY(_x) gettimeofday(_x)
00080 #else
00081 #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
00082 #endif
00083 #define ADD_TIME(dest, src1, src2) { \
00084   if(((dest).tv_usec = \
00085     (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
00086     (dest).tv_usec -= 1000000; \
00087     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
00088   } else { \
00089     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
00090     if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
00091       (dest).tv_sec --;(dest).tv_usec += 1000000; \
00092     } \
00093   } \
00094 }
00095 #define TIMEDELTA(dest, src1, src2) { \
00096   if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
00097     (dest).tv_usec += 1000000; \
00098     (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
00099   } else { \
00100      (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
00101   } \
00102 }
00103 #define IS_AFTER(t1, t2) \
00104   (((t2).tv_sec > (t1).tv_sec) || \
00105   (((t2).tv_sec == (t1).tv_sec) && \
00106   ((t2).tv_usec > (t1).tv_usec)))
00107 #define IS_AT_OR_AFTER(t1, t2) \
00108   (((t2).tv_sec > (t1).tv_sec) || \
00109   (((t2).tv_sec == (t1).tv_sec) && \
00110   ((t2).tv_usec >= (t1).tv_usec)))
00111 #endif
00112 
00113 #define IGNORE_IN_GAME_MODE() \
00114   { if (__glutGameModeWindow) return; }
00115 
00116 #define GLUT_WIND_IS_RGB(x)         (((x) & GLUT_INDEX) == 0)
00117 #define GLUT_WIND_IS_INDEX(x)       (((x) & GLUT_INDEX) != 0)
00118 #define GLUT_WIND_IS_SINGLE(x)      (((x) & GLUT_DOUBLE) == 0)
00119 #define GLUT_WIND_IS_DOUBLE(x)      (((x) & GLUT_DOUBLE) != 0)
00120 #define GLUT_WIND_HAS_ACCUM(x)      (((x) & GLUT_ACCUM) != 0)
00121 #define GLUT_WIND_HAS_ALPHA(x)      (((x) & GLUT_ALPHA) != 0)
00122 #define GLUT_WIND_HAS_DEPTH(x)      (((x) & GLUT_DEPTH) != 0)
00123 #define GLUT_WIND_HAS_STENCIL(x)    (((x) & GLUT_STENCIL) != 0)
00124 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
00125 #define GLUT_WIND_IS_STEREO(x)      (((x) & GLUT_STEREO) != 0)
00126 #define GLUT_WIND_IS_LUMINANCE(x)   (((x) & GLUT_LUMINANCE) != 0)
00127 #define GLUT_MAP_WORK               (1 << 0)
00128 #define GLUT_EVENT_MASK_WORK        (1 << 1)
00129 #define GLUT_REDISPLAY_WORK         (1 << 2)
00130 #define GLUT_CONFIGURE_WORK         (1 << 3)
00131 #define GLUT_COLORMAP_WORK          (1 << 4)
00132 #define GLUT_DEVICE_MASK_WORK     (1 << 5)
00133 #define GLUT_FINISH_WORK       (1 << 6)
00134 #define GLUT_DEBUG_WORK        (1 << 7)
00135 #define GLUT_DUMMY_WORK        (1 << 8)
00136 #define GLUT_FULL_SCREEN_WORK       (1 << 9)
00137 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
00138 #define GLUT_REPAIR_WORK            (1 << 11)
00139 #define GLUT_OVERLAY_REPAIR_WORK    (1 << 12)
00140 
00141 /* Frame buffer capability macros and types. */
00142 #define RGBA                    0
00143 #define BUFFER_SIZE             1
00144 #define DOUBLEBUFFER            2
00145 #define STEREO                  3
00146 #define AUX_BUFFERS             4
00147 #define RED_SIZE                5  /* Used as mask bit for
00148                                       "color selected". */
00149 #define GREEN_SIZE              6
00150 #define BLUE_SIZE               7
00151 #define ALPHA_SIZE              8
00152 #define DEPTH_SIZE              9
00153 #define STENCIL_SIZE            10
00154 #define ACCUM_RED_SIZE          11  /* Used as mask bit for
00155                                        "acc selected". */
00156 #define ACCUM_GREEN_SIZE        12
00157 #define ACCUM_BLUE_SIZE         13
00158 #define ACCUM_ALPHA_SIZE        14
00159 #define LEVEL                   15
00160 
00161 #define NUM_GLXCAPS             (LEVEL + 1)
00162 
00163 #define XVISUAL                 (NUM_GLXCAPS + 0)
00164 #define TRANSPARENT             (NUM_GLXCAPS + 1)
00165 #define SAMPLES                 (NUM_GLXCAPS + 2)
00166 #define XSTATICGRAY             (NUM_GLXCAPS + 3)  /* Used as
00167                                                       mask bit
00168                                                       for "any
00169                                                       visual type 
00170                                                       selected". */
00171 #define XGRAYSCALE              (NUM_GLXCAPS + 4)
00172 #define XSTATICCOLOR            (NUM_GLXCAPS + 5)
00173 #define XPSEUDOCOLOR            (NUM_GLXCAPS + 6)
00174 #define XTRUECOLOR              (NUM_GLXCAPS + 7)
00175 #define XDIRECTCOLOR            (NUM_GLXCAPS + 8)
00176 #define SLOW                    (NUM_GLXCAPS + 9)
00177 #define CONFORMANT              (NUM_GLXCAPS + 10)
00178 
00179 #define NUM_CAPS                (NUM_GLXCAPS + 11)
00180 
00181 /* Frame buffer capablities that don't have a corresponding
00182    FrameBufferMode entry.  These get used as mask bits. */
00183 #define NUM                     (NUM_CAPS + 0)
00184 #define RGBA_MODE               (NUM_CAPS + 1)
00185 #define CI_MODE                 (NUM_CAPS + 2)
00186 #define LUMINANCE_MODE     (NUM_CAPS + 3)
00187 
00188 #define NONE         0
00189 #define EQ        1
00190 #define NEQ       2
00191 #define LTE       3
00192 #define GTE       4
00193 #define GT        5
00194 #define LT        6
00195 #define MIN       7
00196 
00197 typedef struct _Criterion {
00198   int capability;
00199   int comparison;
00200   int value;
00201 } Criterion;
00202 
00203 typedef struct _FrameBufferMode {
00204   XVisualInfo *vi;
00205 #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
00206 
00207   /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
00208      (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
00209      the visual's fbconfig is OpenGL-capable.  The reason for this is typically
00210      an RGBA luminance fbconfig such as 16-bit StaticGray that could
00211      not be advertised as a GLX visual since StaticGray visuals are
00212      required (by the GLX specification) to be color index.  The
00213      SGIX_fbconfig allows StaticGray visuals to instead advertised as
00214      fbconfigs that can provide RGBA luminance support. */
00215 
00216   GLXFBConfigSGIX fbc;
00217 #endif
00218   int valid;
00219   int cap[NUM_CAPS];
00220 } FrameBufferMode;
00221 
00222 /* DisplayMode capability macros for game mode. */
00223 #define DM_WIDTH        0  /* "width" */
00224 #define DM_HEIGHT       1  /* "height" */
00225 #define DM_PIXEL_DEPTH  2  /* "bpp" (bits per pixel) */
00226 #define DM_HERTZ        3  /* "hertz" */
00227 #define DM_NUM          4  /* "num" */
00228 
00229 #define NUM_DM_CAPS     (DM_NUM+1)
00230 
00231 typedef struct _DisplayMode {
00232 #ifdef _WIN32
00233   DEVMODE devmode;
00234 #else
00235   /* XXX The X Window System does not have a standard
00236      mechanism for display setting changes.  On SGI
00237      systems, GLUT could use the XSGIvc (SGI X video
00238      control extension).  Perhaps this can be done in
00239      a future release of GLUT. */
00240 #endif
00241   int valid;
00242   int cap[NUM_DM_CAPS];
00243 } DisplayMode;
00244 
00245 /* GLUT  function types */
00246 typedef void (*GLUTdisplayCB) (void);
00247 typedef void (*GLUTreshapeCB) (int, int);
00248 typedef void (*GLUTkeyboardCB) (unsigned char, int, int);
00249 typedef void (*GLUTmouseCB) (int, int, int, int);
00250 typedef void (*GLUTmotionCB) (int, int);
00251 typedef void (*GLUTpassiveCB) (int, int);
00252 typedef void (*GLUTentryCB) (int);
00253 typedef void (*GLUTvisibilityCB) (int);
00254 typedef void (*GLUTwindowStatusCB) (int);
00255 typedef void (*GLUTidleCB) (void);
00256 typedef void (*GLUTtimerCB) (int);
00257 typedef void (*GLUTmenuStateCB) (int);  /* DEPRICATED. */
00258 typedef void (*GLUTmenuStatusCB) (int, int, int);
00259 typedef void (*GLUTselectCB) (int);
00260 typedef void (*GLUTspecialCB) (int, int, int);
00261 typedef void (*GLUTspaceMotionCB) (int, int, int);
00262 typedef void (*GLUTspaceRotateCB) (int, int, int);
00263 typedef void (*GLUTspaceButtonCB) (int, int);
00264 typedef void (*GLUTdialsCB) (int, int);
00265 typedef void (*GLUTbuttonBoxCB) (int, int);
00266 typedef void (*GLUTtabletMotionCB) (int, int);
00267 typedef void (*GLUTtabletButtonCB) (int, int, int, int);
00268 typedef void (*GLUTwacomMotionCB) (int, int, float, float, float, float, float, int);
00269 typedef void (*GLUTwacomButtonCB) (int, int, int, int, float, float, float, float, float, int);
00270 typedef void (*GLUTmoveCB) (int, int);
00271 typedef void (*GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
00272 #ifdef SUPPORT_FORTRAN
00273 typedef void (*GLUTdisplayFCB) (void);
00274 typedef void (*GLUTreshapeFCB) (int *, int *);
00275 /* NOTE the pressed key is int, not unsigned char for Fortran! */
00276 typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
00277 typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
00278 typedef void (*GLUTmotionFCB) (int *, int *);
00279 typedef void (*GLUTpassiveFCB) (int *, int *);
00280 typedef void (*GLUTentryFCB) (int *);
00281 typedef void (*GLUTvisibilityFCB) (int *);
00282 typedef void (*GLUTwindowStatusFCB) (int *);
00283 typedef void (*GLUTidleFCB) (void);
00284 typedef void (*GLUTtimerFCB) (int *);
00285 typedef void (*GLUTmenuStateFCB) (int *);  /* DEPRICATED. */
00286 typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
00287 typedef void (*GLUTselectFCB) (int *);
00288 typedef void (*GLUTspecialFCB) (int *, int *, int *);
00289 typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
00290 typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
00291 typedef void (*GLUTspaceButtonFCB) (int *, int *);
00292 typedef void (*GLUTdialsFCB) (int *, int *);
00293 typedef void (*GLUTbuttonBoxFCB) (int *, int *);
00294 typedef void (*GLUTtabletMotionFCB) (int *, int *);
00295 typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
00296 typedef void (*GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
00297 #endif
00298 
00299 typedef struct _GLUTcolorcell GLUTcolorcell;
00300 struct _GLUTcolorcell {
00301   /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
00302   GLfloat component[3];
00303 };
00304 
00305 typedef struct _GLUTcolormap GLUTcolormap;
00306 struct _GLUTcolormap {
00307   Visual *visual;       /* visual of the colormap */
00308   Colormap cmap;        /* X colormap ID */
00309   int refcnt;           /* number of windows using colormap */
00310   int size;             /* number of cells in colormap */
00311   int transparent;      /* transparent pixel, or -1 if opaque */
00312   GLUTcolorcell *cells; /* array of cells */
00313   GLUTcolormap *next;   /* next colormap in list */
00314 };
00315 
00316 typedef struct _GLUTwindow GLUTwindow;
00317 typedef struct _GLUToverlay GLUToverlay;
00318 struct _GLUTwindow {
00319   int num;              /* Small integer window id (0-based). */
00320 
00321   /* Window system related state. */
00322 #if defined(_WIN32)
00323   int pf;               /* Pixel format. */
00324   HDC hdc;              /* Window's Win32 device context. */
00325 #endif
00326   Window win;           /* X window for GLUT window */
00327   GLXContext ctx;       /* OpenGL context GLUT glut window */
00328   XVisualInfo *vis;     /* visual for window */
00329   Bool visAlloced;      /* if vis needs deallocate on destroy */
00330   Colormap cmap;        /* RGB colormap for window; None if CI */
00331   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
00332   GLUToverlay *overlay; /* overlay; NULL if no overlay */
00333 #if defined(_WIN32)
00334   HDC renderDc;         /* Win32's device context for rendering. */
00335 #endif
00336   Window renderWin;     /* X window for rendering (might be
00337                            overlay) */
00338   GLXContext renderCtx; /* OpenGL context for rendering (might
00339                            be overlay) */
00340   /* GLUT settable or visible window state. */
00341   /*int x;*/            /* x current origin relative to the root window */
00342   /*int y;*/            /* y current origin relative to the root window */
00343   /* FIXME: very strange bug!
00344      When these two variables are declared here, key press events disappear! */
00345   int width;            /* window width in pixels */
00346   int height;           /* window height in pixels */
00347   int cursor;           /* cursor name */
00348   int visState;         /* visibility state (-1 is unknown) */
00349   int shownState;       /* if window mapped */
00350   int entryState;       /* entry state (-1 is unknown) */
00351 #define GLUT_MAX_MENUS              3
00352 
00353   int menu[GLUT_MAX_MENUS];  /* attatched menu nums */
00354   /* Window relationship state. */
00355   GLUTwindow *parent;   /* parent window */
00356   GLUTwindow *children; /* list of children */
00357   GLUTwindow *siblings; /* list of siblings */
00358   /* Misc. non-API visible (hidden) state. */
00359   Bool treatAsSingle;   /* treat this window as single-buffered
00360                            (it might be "fake" though) */
00361   Bool forceReshape;    /* force reshape before display */
00362 #if !defined(_WIN32)
00363   Bool isDirect;        /* if direct context (X11 only) */
00364 #endif
00365   Bool usedSwapBuffers; /* if swap buffers used last display */
00366   long eventMask;       /* mask of X events selected for */
00367   int buttonUses;       /* number of button uses, ref cnt */
00368   int tabletPos[2];     /* tablet position (-1 is invalid) */
00369   /* Work list related state. */
00370   unsigned int workMask;  /* mask of window work to be done */
00371   GLUTwindow *prevWorkWin;  /* link list of windows to work on */
00372   Bool desiredMapState; /* how to mapped window if on map work
00373                            list */
00374   Bool ignoreKeyRepeat;  /* if window ignores autorepeat */
00375   int desiredConfMask;  /* mask of desired window configuration
00376                          */
00377   int desiredX;         /* desired X location */
00378   int desiredY;         /* desired Y location */
00379   int desiredWidth;     /* desired window width */
00380   int desiredHeight;    /* desired window height */
00381   int desiredStack;     /* desired window stack */
00382   /* Per-window callbacks. */
00383   GLUTdisplayCB display;  /* redraw */
00384   GLUTreshapeCB reshape;  /* resize (width,height) */
00385   GLUTmouseCB mouse;    /* mouse (button,state,x,y) */
00386   GLUTmotionCB motion;  /* motion (x,y) */
00387   GLUTpassiveCB passive;  /* passive motion (x,y) */
00388   GLUTentryCB entry;    /* window entry/exit (state) */
00389   GLUTkeyboardCB keyboard;  /* keyboard (ASCII,x,y) */
00390   GLUTkeyboardCB keyboardUp;  /* keyboard up (ASCII,x,y) */
00391   GLUTwindowStatusCB windowStatus;  /* window status */
00392   GLUTvisibilityCB visibility;  /* visibility */
00393   GLUTspecialCB special;  /* special key */
00394   GLUTspecialCB specialUp;  /* special up key */
00395   GLUTbuttonBoxCB buttonBox;  /* button box */
00396   GLUTdialsCB dials;    /* dials */
00397   GLUTspaceMotionCB spaceMotion;  /* Spaceball motion */
00398   GLUTspaceRotateCB spaceRotate;  /* Spaceball rotate */
00399   GLUTspaceButtonCB spaceButton;  /* Spaceball button */
00400   GLUTtabletMotionCB tabletMotion;  /* tablet motion */
00401   GLUTtabletButtonCB tabletButton;  /* tablet button */
00402   GLUTwacomMotionCB wacomMotion;  /* wacom motion */
00403   GLUTwacomButtonCB wacomButton;  /* wacom button */
00404   GLUTmoveCB move;   /* change window coordinates (x, y) */
00405   int x, y;          /* current origin relative to the root window */
00406 #ifdef _WIN32
00407   GLUTjoystickCB joystick;  /* joystick */
00408   int joyPollInterval; /* joystick polling interval */
00409 #endif
00410 #ifdef SUPPORT_FORTRAN
00411   /* Special Fortran display  unneeded since no
00412      parameters! */
00413   GLUTreshapeFCB freshape;  /* Fortran reshape  */
00414   GLUTmouseFCB fmouse;  /* Fortran mouse  */
00415   GLUTmotionFCB fmotion;  /* Fortran motion  */
00416   GLUTpassiveFCB fpassive;  /* Fortran passive  */
00417   GLUTentryFCB fentry;  /* Fortran entry  */
00418   GLUTkeyboardFCB fkeyboard;  /* Fortran keyboard  */
00419   GLUTkeyboardFCB fkeyboardUp;  /* Fortran keyboard up */
00420   GLUTwindowStatusFCB fwindowStatus;  /* Fortran visibility
00421                                           */
00422   GLUTvisibilityFCB fvisibility;  /* Fortran visibility
00423                                       */
00424   GLUTspecialFCB fspecial;  /* special key */
00425   GLUTspecialFCB fspecialUp;  /* special key up */
00426   GLUTbuttonBoxFCB fbuttonBox;  /* button box */
00427   GLUTdialsFCB fdials;  /* dials */
00428   GLUTspaceMotionFCB fspaceMotion;  /* Spaceball motion
00429                                         */
00430   GLUTspaceRotateFCB fspaceRotate;  /* Spaceball rotate
00431                                         */
00432   GLUTspaceButtonFCB fspaceButton;  /* Spaceball button
00433                                         */
00434   GLUTtabletMotionFCB ftabletMotion;  /* tablet motion
00435                                        */
00436   GLUTtabletButtonFCB ftabletButton;  /* tablet button
00437                                        */
00438 #ifdef _WIN32
00439   GLUTjoystickFCB fjoystick;  /* joystick */
00440 #endif
00441 #endif
00442 };
00443 
00444 struct _GLUToverlay {
00445 #if defined(_WIN32)
00446   int pf;
00447   HDC hdc;
00448 #endif
00449   Window win;
00450   GLXContext ctx;
00451   XVisualInfo *vis;     /* visual for window */
00452   Bool visAlloced;      /* if vis needs deallocate on destroy */
00453   Colormap cmap;        /* RGB colormap for window; None if CI */
00454   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
00455   int shownState;       /* if overlay window mapped */
00456   Bool treatAsSingle;   /* treat as single-buffered */
00457 #if !defined(_WIN32)
00458   Bool isDirect;        /* if direct context */
00459 #endif
00460   int transparentPixel; /* transparent pixel value */
00461   GLUTdisplayCB display;  /* redraw  */
00462   /* Special Fortran display  unneeded since no
00463      parameters! */
00464 };
00465 
00466 typedef struct _GLUTstale GLUTstale;
00467 struct _GLUTstale {
00468   GLUTwindow *window;
00469   Window win;
00470   GLUTstale *next;
00471 };
00472 
00473 extern GLUTstale *__glutStaleWindowList;
00474 
00475 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
00476   (ExposureMask | \
00477   StructureNotifyMask | \
00478   EnterWindowMask | \
00479   LeaveWindowMask)
00480 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
00481   (ButtonReleaseMask | \
00482   ButtonPressMask | \
00483   KeyPressMask | \
00484   KeyReleaseMask | \
00485   PointerMotionMask | \
00486   Button1MotionMask | \
00487   Button2MotionMask | \
00488   Button3MotionMask)
00489 #define GLUT_HACK_STOP_PROPAGATE_MASK \
00490   (KeyPressMask | \
00491   KeyReleaseMask)
00492 
00493 typedef struct _GLUTmenu GLUTmenu;
00494 typedef struct _GLUTmenuItem GLUTmenuItem;
00495 struct _GLUTmenu {
00496   int id;               /* small integer menu id (0-based) */
00497   Window win;           /* X window for the menu */
00498   GLUTselectCB select;  /*  function of menu */
00499   GLUTmenuItem *list;   /* list of menu entries */
00500   int num;              /* number of entries */
00501 #if !defined(_WIN32)
00502   Bool managed;         /* are the InputOnly windows size
00503                            validated? */
00504   Bool searched;  /* help detect menu loops */
00505   int pixheight;        /* height of menu in pixels */
00506   int pixwidth;         /* width of menu in pixels */
00507 #endif
00508   int submenus;         /* number of submenu entries */
00509   GLUTmenuItem *highlighted;  /* pointer to highlighted menu
00510                                  entry, NULL not highlighted */
00511   GLUTmenu *cascade;    /* currently cascading this menu  */
00512   GLUTmenuItem *anchor; /* currently anchored to this entry */
00513   int x;                /* current x origin relative to the
00514                            root window */
00515   int y;                /* current y origin relative to the
00516                            root window */
00517 #ifdef SUPPORT_FORTRAN
00518   GLUTselectFCB fselect;  /*  function of menu */
00519 #endif
00520 };
00521 
00522 struct _GLUTmenuItem {
00523   Window win;           /* InputOnly X window for entry */
00524   GLUTmenu *menu;       /* menu entry belongs to */
00525   Bool isTrigger;       /* is a submenu trigger? */
00526   int value;            /* value to return for selecting this
00527                            entry; doubles as submenu id
00528                            (0-base) if submenu trigger */
00529 #if defined(_WIN32)
00530   UINT unique;          /* unique menu item id (Win32 only) */
00531 #endif
00532   char *label;          /* __glutStrdup'ed label string */
00533   int len;              /* length of label string */
00534   int pixwidth;         /* width of X window in pixels */
00535   GLUTmenuItem *next;   /* next menu entry on list for menu */
00536 };
00537 
00538 typedef struct _GLUTtimer GLUTtimer;
00539 struct _GLUTtimer {
00540   GLUTtimer *next;      /* list of timers */
00541   struct timeval timeout;  /* time to be called */
00542   GLUTtimerCB func;     /* timer  (value) */
00543   int value;            /*  return value */
00544 #ifdef SUPPORT_FORTRAN
00545   GLUTtimerFCB ffunc;   /* Fortran timer  */
00546 #endif
00547 };
00548 
00549 typedef struct _GLUTeventParser GLUTeventParser;
00550 struct _GLUTeventParser {
00551   int (*func) (XEvent *);
00552   GLUTeventParser *next;
00553 };
00554 
00555 /* Declarations to implement glutFullScreen support with
00556    mwm/4Dwm. */
00557 
00558 /* The following X property format is defined in Motif 1.1's
00559    Xm/MwmUtils.h, but GLUT should not depend on that header
00560    file. Note: Motif 1.2 expanded this structure with
00561    uninteresting fields (to GLUT) so just stick with the
00562    smaller Motif 1.1 structure. */
00563 typedef struct {
00564 #define MWM_HINTS_DECORATIONS   2
00565   long flags;
00566   long functions;
00567   long decorations;
00568   long input_mode;
00569 } MotifWmHints;
00570 
00571 /* Make current and buffer swap macros. */
00572 #ifdef _WIN32
00573 #define MAKE_CURRENT_LAYER(window)                                    \
00574   {                                                                   \
00575     HGLRC currentContext = wglGetCurrentContext();                    \
00576     HDC currentDc = wglGetCurrentDC();                                \
00577                                                                       \
00578     if (currentContext != window->renderCtx                           \
00579       || currentDc != window->renderDc) {                             \
00580       wglMakeCurrent(window->renderDc, window->renderCtx);            \
00581     }                                                                 \
00582   }
00583 #define MAKE_CURRENT_WINDOW(window)                                   \
00584   {                                                                   \
00585     HGLRC currentContext = wglGetCurrentContext();                    \
00586     HDC currentDc = wglGetCurrentDC();                                \
00587                                                                       \
00588     if (currentContext != window->ctx || currentDc != window->hdc) {  \
00589       wglMakeCurrent(window->hdc, window->ctx);                       \
00590     }                                                                 \
00591   }
00592 #define MAKE_CURRENT_OVERLAY(overlay) \
00593   wglMakeCurrent(overlay->hdc, overlay->ctx)
00594 #define UNMAKE_CURRENT() \
00595   wglMakeCurrent(NULL, NULL)
00596 #define SWAP_BUFFERS_WINDOW(window) \
00597   SwapBuffers(window->hdc)
00598 #define SWAP_BUFFERS_LAYER(window) \
00599   SwapBuffers(window->renderDc)
00600 #else
00601 #define MAKE_CURRENT_LAYER(window) \
00602   glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
00603 #define MAKE_CURRENT_WINDOW(window) \
00604   glXMakeCurrent(__glutDisplay, window->win, window->ctx)
00605 #define MAKE_CURRENT_OVERLAY(overlay) \
00606   glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
00607 #define UNMAKE_CURRENT() \
00608   glXMakeCurrent(__glutDisplay, None, NULL)
00609 #define SWAP_BUFFERS_WINDOW(window) \
00610   glXSwapBuffers(__glutDisplay, window->win)
00611 #define SWAP_BUFFERS_LAYER(window) \
00612   glXSwapBuffers(__glutDisplay, window->renderWin)
00613 #endif
00614 
00615 /* private variables from glut_event.c */
00616 extern GLUTwindow *__glutWindowWorkList;
00617 extern int __glutWindowDamaged;
00618 #ifdef SUPPORT_FORTRAN
00619 extern GLUTtimer *__glutTimerList;
00620 extern GLUTtimer *__glutNewTimer;
00621 #endif
00622 extern GLUTmenu *__glutMappedMenu;
00623 
00624 extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
00625 #if !defined(_WIN32)
00626 extern void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item,
00627   int num, int type);
00628 extern void (*__glutFinishMenu)(Window win, int x, int y);
00629 extern void (*__glutPaintMenu)(GLUTmenu * menu);
00630 extern void (*__glutStartMenu)(GLUTmenu * menu,
00631   GLUTwindow * window, int x, int y, int x_win, int y_win);
00632 extern GLUTmenu * (*__glutGetMenuByNum)(int menunum);
00633 extern GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu,
00634   Window win, int *which);
00635 extern GLUTmenu * (*__glutGetMenu)(Window win);
00636 #endif
00637 
00638 /* private variables from glut_init.c */
00639 extern Atom __glutWMDeleteWindow;
00640 extern Display *__glutDisplay;
00641 extern unsigned int __glutDisplayMode;
00642 extern char *__glutDisplayString;
00643 extern XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle,
00644   Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc);
00645 extern GLboolean __glutDebug;
00646 extern GLboolean __glutForceDirect;
00647 extern GLboolean __glutIconic;
00648 extern GLboolean __glutTryDirect;
00649 extern Window __glutRoot;
00650 extern XSizeHints __glutSizeHints;
00651 extern char **__glutArgv;
00652 extern char *__glutProgramName;
00653 extern int __glutArgc;
00654 extern int __glutConnectionFD;
00655 extern int __glutInitHeight;
00656 extern int __glutInitWidth;
00657 extern int __glutInitX;
00658 extern int __glutInitY;
00659 extern int __glutScreen;
00660 extern int __glutScreenHeight;
00661 extern int __glutScreenWidth;
00662 extern Atom __glutMotifHints;
00663 extern unsigned int __glutModifierMask;
00664 
00665 /* private variables from glut_menu.c */
00666 extern GLUTmenuItem *__glutItemSelected;
00667 extern GLUTmenu **__glutMenuList;
00668 extern void (*__glutMenuStatusFunc) (int, int, int);
00669 extern void __glutMenuModificationError(void);
00670 extern void __glutSetMenuItem(GLUTmenuItem * item,
00671   const char *label, int value, Bool isTrigger);
00672 
00673 /* private variables from glut_wacom.c */
00674 extern int __glutWacomButton;
00675 extern int __glutWacomState;
00676 extern float __glutWacomX, __glutWacomY;
00677 extern float __glutWacomPressure;
00678 extern float __glutWacomXTilt, __glutWacomYTilt;
00679 
00680 /* private variables from glut_win.c */
00681 extern GLUTwindow **__glutWindowList;
00682 extern GLUTwindow *__glutCurrentWindow;
00683 extern GLUTwindow *__glutMenuWindow;
00684 extern GLUTmenu *__glutCurrentMenu;
00685 extern int __glutWindowListSize;
00686 extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
00687 extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle,
00688   Bool * visAlloced, void **fbc);
00689 
00690 /* private variables from glut_mesa.c */
00691 extern int __glutMesaSwapHackSupport;
00692 
00693 /* private variables from glut_gamemode.c */
00694 extern GLUTwindow *__glutGameModeWindow;
00695 
00696 /* private routines from glut_cindex.c */
00697 extern GLUTcolormap * __glutAssociateNewColormap(XVisualInfo * vis);
00698 extern void __glutFreeColormap(GLUTcolormap *);
00699 
00700 /* private routines from glut_cmap.c */
00701 extern void __glutSetupColormap(
00702   XVisualInfo * vi,
00703   GLUTcolormap ** colormap,
00704   Colormap * cmap);
00705 #if !defined(_WIN32)
00706 extern void __glutEstablishColormapsProperty(
00707   GLUTwindow * window);
00708 extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
00709 #endif
00710 
00711 /* private routines from glut_cursor.c */
00712 extern void __glutSetCursor(GLUTwindow *window);
00713 
00714 /* private routines from glut_event.c */
00715 extern void __glutPutOnWorkList(GLUTwindow * window,
00716   int work_mask);
00717 extern void __glutRegisterEventParser(GLUTeventParser * parser);
00718 extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
00719 
00720 /* private routines from glut_init.c */
00721 #if !defined(_WIN32)
00722 extern void __glutOpenXConnection(char *display);
00723 #else
00724 extern void __glutOpenWin32Connection(char *display);
00725 #endif
00726 extern void __glutInitTime(struct timeval *beginning);
00727 
00728 /* private routines for glut_menu.c (or win32_menu.c) */
00729 #if defined(_WIN32)
00730 extern GLUTmenu *__glutGetMenu(Window win);
00731 extern GLUTmenu *__glutGetMenuByNum(int menunum);
00732 extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
00733   Window win, int *which);
00734 extern void __glutStartMenu(GLUTmenu * menu,
00735   GLUTwindow * window, int x, int y, int x_win, int y_win);
00736 extern void __glutFinishMenu(Window win, int x, int y);
00737 #endif
00738 extern void __glutSetMenu(GLUTmenu * menu);
00739 
00740 /* private routines from glut_util.c */
00741 extern char * __glutStrdup(const char *string);
00742 extern void __glutWarning(char *format,...);
00743 extern void __glutFatalError(char *format,...);
00744 extern void __glutFatalUsage(char *format,...);
00745 
00746 /* private routines from glut_wacom.c */
00747 extern void __glutWacomSetOffset(int x, int y);
00748 extern void __glutWacomSetButton(int device, int button);
00749 extern void __glutWacomUpdate(int x, int y, int pressure, int xtilt, int ytilt);
00750 extern void __glutWacomCalibrate(void);
00751 
00752 /* private routines from glut_win.c */
00753 extern GLUTwindow *__glutGetWindow(Window win);
00754 extern void __glutChangeWindowEventMask(long mask, Bool add);
00755 extern XVisualInfo *__glutDetermineVisual(
00756   unsigned int mode,
00757   Bool * fakeSingle,
00758   XVisualInfo * (getVisualInfo) (unsigned int));
00759 extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
00760 extern void __glutSetWindow(GLUTwindow * window);
00761 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
00762   int callingConvention);
00763 extern void  __glutDefaultReshape(int, int);
00764 extern GLUTwindow *__glutCreateWindow(
00765   GLUTwindow * parent,
00766   int x, int y, int width, int height, int gamemode);
00767 extern void __glutDestroyWindow(
00768   GLUTwindow * window,
00769   GLUTwindow * initialWindow);
00770 
00771 #if !defined(_WIN32)
00772 /* private routines from glut_glxext.c */
00773 extern int __glutIsSupportedByGLX(char *);
00774 #endif
00775 
00776 /* private routines from glut_input.c */
00777 extern void  __glutUpdateInputDeviceMask(GLUTwindow * window);
00778 
00779 /* private routines from glut_mesa.c */
00780 extern void __glutDetermineMesaSwapHackSupport(void);
00781 
00782 /* private routines from glut_gameglut.c */
00783 extern void __glutCloseDownGameMode(void);
00784 
00785 #if defined(_WIN32)
00786 /* private routines from win32_*.c */
00787 extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l);
00788 extern HDC XHDC;
00789 #endif
00790 
00791 #endif /* __glutint_h__ */

Generated on Mon Sep 18 11:39:31 2006 for jot by  doxygen 1.4.4