Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
glutint.h
Go to the documentation of this file.00001 #ifndef __glutint_h__
00002 #define __glutint_h__
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef __sgi
00011 #define SUPPORT_FORTRAN
00012 #endif
00013 #include <X11/Xlib.h>
00014 #include <GL/glx.h>
00015 #include <GL/glut.h>
00016 #ifdef __vms
00017 struct timeval {
00018 __int64 val;
00019 };
00020 extern int sys$gettim(struct timeval *);
00021 #else
00022 #include <sys/types.h>
00023 #include <sys/time.h>
00024 #endif
00025 #if defined(__vms)
00026
00027
00028
00029
00030
00031
00032 #define TICKS_PER_MILLISECOND 10000
00033 #define TICKS_PER_SECOND 10000000
00034
00035 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
00036
00037 #define ADD_TIME(dest, src1, src2) { \
00038 (dest).val = (src1).val + (src2).val; \
00039 }
00040
00041 #define TIMEDELTA(dest, src1, src2) { \
00042 (dest).val = (src1).val - (src2).val; \
00043 }
00044
00045 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
00046
00047 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
00048
00049 #else
00050 #if defined(SVR4) && !defined(sun)
00051 #define GETTIMEOFDAY(_x) gettimeofday(_x)
00052 #else
00053 #define GETTIMEOFDAY(_x) gettimeofday(_x, (struct timezone*) NULL)
00054 #endif
00055 #define ADD_TIME(dest, src1, src2) { \
00056 if(((dest).tv_usec = \
00057 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
00058 (dest).tv_usec -= 1000000; \
00059 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
00060 } else { \
00061 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
00062 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
00063 (dest).tv_sec --;(dest).tv_usec += 1000000; \
00064 } \
00065 } \
00066 }
00067 #define TIMEDELTA(dest, src1, src2) { \
00068 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
00069 (dest).tv_usec += 1000000; \
00070 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
00071 } else { \
00072 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
00073 } \
00074 }
00075 #define IS_AFTER(t1, t2) \
00076 (((t2).tv_sec > (t1).tv_sec) || \
00077 (((t2).tv_sec == (t1).tv_sec) && \
00078 ((t2).tv_usec > (t1).tv_usec)))
00079 #define IS_AT_OR_AFTER(t1, t2) \
00080 (((t2).tv_sec > (t1).tv_sec) || \
00081 (((t2).tv_sec == (t1).tv_sec) && \
00082 ((t2).tv_usec >= (t1).tv_usec)))
00083 #endif
00084 #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
00085 #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
00086 #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
00087 #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
00088 #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
00089 #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
00090 #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
00091 #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
00092 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
00093 #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
00094 #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
00095 #define GLUT_MAP_WORK (1 << 0)
00096 #define GLUT_EVENT_MASK_WORK (1 << 1)
00097 #define GLUT_REDISPLAY_WORK (1 << 2)
00098 #define GLUT_CONFIGURE_WORK (1 << 3)
00099 #define GLUT_COLORMAP_WORK (1 << 4)
00100 #define GLUT_DEVICE_MASK_WORK (1 << 5)
00101 #define GLUT_FINISH_WORK (1 << 6)
00102 #define GLUT_DEBUG_WORK (1 << 7)
00103 #define GLUT_DUMMY_WORK (1 << 8)
00104 #define GLUT_FULL_SCREEN_WORK (1 << 9)
00105 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
00106
00107 typedef void (*GLUTdisplayCB) (void);
00108 typedef void (*GLUTreshapeCB) (int, int);
00109 typedef void (*GLUTkeyboardCB) (unsigned char, int, int);
00110 typedef void (*GLUTmouseCB) (int, int, int, int);
00111 typedef void (*GLUTmotionCB) (int, int);
00112 typedef void (*GLUTpassiveCB) (int, int);
00113 typedef void (*GLUTentryCB) (int);
00114 typedef void (*GLUTvisibilityCB) (int);
00115 typedef void (*GLUTidleCB) (void);
00116 typedef void (*GLUTtimerCB) (int);
00117 typedef void (*GLUTmenuStateCB) (int);
00118 typedef void (*GLUTmenuStatusCB) (int, int, int);
00119 typedef void (*GLUTselectCB) (int);
00120 typedef void (*GLUTspecialCB) (int, int, int);
00121 typedef void (*GLUTspaceMotionCB) (int, int, int);
00122 typedef void (*GLUTspaceRotateCB) (int, int, int);
00123 typedef void (*GLUTspaceButtonCB) (int, int);
00124 typedef void (*GLUTdialsCB) (int, int);
00125 typedef void (*GLUTbuttonBoxCB) (int, int);
00126 typedef void (*GLUTtabletMotionCB) (int, int);
00127 typedef void (*GLUTtabletButtonCB) (int, int, int, int);
00128 #ifdef SUPPORT_FORTRAN
00129 typedef void (*GLUTdisplayFCB) (void);
00130 typedef void (*GLUTreshapeFCB) (int *, int *);
00131
00132 typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
00133 typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
00134 typedef void (*GLUTmotionFCB) (int *, int *);
00135 typedef void (*GLUTpassiveFCB) (int *, int *);
00136 typedef void (*GLUTentryFCB) (int *);
00137 typedef void (*GLUTvisibilityFCB) (int *);
00138 typedef void (*GLUTidleFCB) (void);
00139 typedef void (*GLUTtimerFCB) (int *);
00140 typedef void (*GLUTmenuStateFCB) (int *);
00141 typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
00142 typedef void (*GLUTselectFCB) (int *);
00143 typedef void (*GLUTspecialFCB) (int *, int *, int *);
00144 typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
00145 typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
00146 typedef void (*GLUTspaceButtonFCB) (int *, int *);
00147 typedef void (*GLUTdialsFCB) (int *, int *);
00148 typedef void (*GLUTbuttonBoxFCB) (int *, int *);
00149 typedef void (*GLUTtabletMotionFCB) (int *, int *);
00150 typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
00151 #endif
00152 typedef struct _GLUTcolorcell GLUTcolorcell;
00153 struct _GLUTcolorcell {
00154
00155 GLfloat component[3];
00156 };
00157 typedef struct _GLUTcolormap GLUTcolormap;
00158 struct _GLUTcolormap {
00159 Visual *visual;
00160 Colormap cmap;
00161 int refcnt;
00162 int size;
00163 int transparent;
00164 GLUTcolorcell *cells;
00165 GLUTcolormap *next;
00166 };
00167 typedef struct _GLUTwindow GLUTwindow;
00168 typedef struct _GLUToverlay GLUToverlay;
00169 struct _GLUTwindow {
00170 int num;
00171
00172 Window win;
00173 GLXContext ctx;
00174 XVisualInfo *vis;
00175 Colormap cmap;
00176 GLUTcolormap *colormap;
00177 GLUToverlay *overlay;
00178 Window renderWin;
00179
00180 GLXContext renderCtx;
00181
00182
00183 int width;
00184 int height;
00185 int cursor;
00186 int visState;
00187 int shownState;
00188 int entryState;
00189 int damaged;
00190 #define GLUT_MAX_MENUS 3
00191
00192 int menu[GLUT_MAX_MENUS];
00193
00194 GLUTwindow *parent;
00195 GLUTwindow *children;
00196 GLUTwindow *siblings;
00197
00198 Bool fakeSingle;
00199 Bool forceReshape;
00200 Bool isDirect;
00201 long eventMask;
00202 int buttonUses;
00203 int tabletPos[2];
00204
00205 unsigned int workMask;
00206 GLUTwindow *prevWorkWin;
00207 Bool desiredMapState;
00208
00209 int desiredConfMask;
00210
00211 int desiredX;
00212 int desiredY;
00213 int desiredWidth;
00214 int desiredHeight;
00215 int desiredStack;
00216
00217 GLUTdisplayCB display;
00218 GLUTreshapeCB reshape;
00219 GLUTmouseCB mouse;
00220 GLUTmotionCB motion;
00221 GLUTpassiveCB passive;
00222 GLUTentryCB entry;
00223 GLUTkeyboardCB keyboard;
00224 GLUTvisibilityCB visibility;
00225 GLUTspecialCB special;
00226 GLUTbuttonBoxCB buttonBox;
00227 GLUTdialsCB dials;
00228 GLUTspaceMotionCB spaceMotion;
00229 GLUTspaceRotateCB spaceRotate;
00230 GLUTspaceButtonCB spaceButton;
00231 GLUTtabletMotionCB tabletMotion;
00232 GLUTtabletButtonCB tabletButton;
00233 #ifdef SUPPORT_FORTRAN
00234
00235
00236 GLUTreshapeFCB freshape;
00237 GLUTmouseFCB fmouse;
00238 GLUTmotionFCB fmotion;
00239 GLUTpassiveFCB fpassive;
00240 GLUTentryFCB fentry;
00241 GLUTkeyboardFCB fkeyboard;
00242 GLUTvisibilityFCB fvisibility;
00243
00244 GLUTspecialFCB fspecial;
00245 GLUTbuttonBoxFCB fbuttonBox;
00246 GLUTdialsFCB fdials;
00247 GLUTspaceMotionFCB fspaceMotion;
00248
00249 GLUTspaceRotateFCB fspaceRotate;
00250
00251 GLUTspaceButtonFCB fspaceButton;
00252
00253 GLUTtabletMotionFCB ftabletMotion;
00254
00255
00256 GLUTtabletButtonFCB ftabletButton;
00257
00258
00259 #endif
00260 };
00261 struct _GLUToverlay {
00262 Window win;
00263 GLXContext ctx;
00264 XVisualInfo *vis;
00265 Colormap cmap;
00266 GLUTcolormap *colormap;
00267 int shownState;
00268 Bool fakeSingle;
00269 Bool isDirect;
00270 int damaged;
00271 int transparentPixel;
00272 GLUTdisplayCB display;
00273
00274
00275 };
00276 typedef struct _GLUTstale GLUTstale;
00277 struct _GLUTstale {
00278 GLUTwindow *window;
00279 Window win;
00280 GLUTstale *next;
00281 };
00282
00283 extern GLUTstale *__glutStaleWindowList;
00284 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
00285 (ExposureMask | \
00286 StructureNotifyMask | \
00287 EnterWindowMask | \
00288 LeaveWindowMask)
00289 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
00290 (ButtonReleaseMask | \
00291 ButtonPressMask | \
00292 KeyPressMask | \
00293 KeyReleaseMask | \
00294 PointerMotionMask | \
00295 Button1MotionMask | \
00296 Button2MotionMask | \
00297 Button3MotionMask)
00298 #define GLUT_HACK_STOP_PROPAGATE_MASK \
00299 (KeyPressMask | \
00300 KeyReleaseMask)
00301 typedef struct _GLUTmenu GLUTmenu;
00302 typedef struct _GLUTmenuItem GLUTmenuItem;
00303 struct _GLUTmenu {
00304 int id;
00305 Window win;
00306 GLUTselectCB select;
00307 GLUTmenuItem *list;
00308 int num;
00309 Bool managed;
00310
00311 int pixwidth;
00312 int pixheight;
00313 int submenus;
00314 GLUTmenuItem *highlighted;
00315
00316 GLUTmenu *cascade;
00317 GLUTmenuItem *anchor;
00318 int x;
00319
00320 int y;
00321
00322 #ifdef SUPPORT_FORTRAN
00323 GLUTselectFCB fselect;
00324 #endif
00325 };
00326 struct _GLUTmenuItem {
00327 Window win;
00328 GLUTmenu *menu;
00329 Bool isTrigger;
00330 int value;
00331
00332
00333 char *label;
00334 int len;
00335 int pixwidth;
00336 GLUTmenuItem *next;
00337 };
00338 typedef struct _GLUTtimer GLUTtimer;
00339 struct _GLUTtimer {
00340 GLUTtimer *next;
00341 struct timeval timeout;
00342 GLUTtimerCB func;
00343 int value;
00344 #ifdef SUPPORT_FORTRAN
00345 GLUTtimerFCB ffunc;
00346 #endif
00347 };
00348 typedef struct _GLUTeventParser GLUTeventParser;
00349 struct _GLUTeventParser {
00350 int (*func) (XEvent *);
00351 GLUTeventParser *next;
00352 };
00353
00354
00355
00356
00357
00358
00359
00360
00361 typedef struct {
00362 #define MWM_HINTS_DECORATIONS 2
00363 long flags;
00364 long functions;
00365 long decorations;
00366 long input_mode;
00367 } MotifWmHints;
00368
00369 extern GLUTwindow *__glutWindowWorkList;
00370 extern int __glutWindowDamaged;
00371 #ifdef SUPPORT_FORTRAN
00372 extern GLUTtimer *__glutTimerList;
00373 extern GLUTtimer *__glutNewTimer;
00374 #endif
00375
00376
00377 extern Atom __glutWMDeleteWindow;
00378 extern Display *__glutDisplay;
00379 extern unsigned int __glutDisplayMode;
00380 extern GLboolean __glutDebug;
00381 extern GLboolean __glutForceDirect;
00382 extern GLboolean __glutIconic;
00383 extern GLboolean __glutTryDirect;
00384 extern Window __glutRoot;
00385 extern XSizeHints __glutSizeHints;
00386 extern char **__glutArgv;
00387 extern char *__glutProgramName;
00388 extern int __glutArgc;
00389 extern int __glutConnectionFD;
00390 extern int __glutInitHeight;
00391 extern int __glutInitWidth;
00392 extern int __glutInitX;
00393 extern int __glutInitY;
00394 extern int __glutScreen;
00395 extern int __glutScreenHeight;
00396 extern int __glutScreenWidth;
00397 extern Atom __glutMotifHints;
00398 extern unsigned int __glutModifierMask;
00399
00400
00401 extern GLUTmenu *__glutCurrentMenu;
00402 extern GLUTmenuItem *__glutItemSelected;
00403 extern GLUTmenu *__glutMappedMenu;
00404 extern GLUTwindow *__glutMenuWindow;
00405 extern void (*__glutMenuStatusFunc) (int, int, int);
00406
00407
00408 extern GLUTwindow **__glutWindowList;
00409 extern GLUTwindow *__glutCurrentWindow;
00410 extern int __glutWindowListSize;
00411 extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
00412
00413
00414 extern GLUTcolormap *__glutAssociateColormap(XVisualInfo * vis);
00415 extern void __glutFreeColormap(GLUTcolormap *);
00416
00417
00418 extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
00419 extern void __glutPutOnWorkList(GLUTwindow * window,
00420 int work_mask);
00421 extern void __glutRegisterEventParser(GLUTeventParser * parser);
00422 extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
00423
00424
00425 extern void __glutOpenXConnection(char *display);
00426 extern void __glutInitTime(struct timeval *beginning);
00427
00428
00429 extern GLUTmenu *__glutGetMenu(Window win);
00430 extern GLUTmenu *__glutGetMenuByNum(int menunum);
00431 extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
00432 Window win, int *which);
00433 extern void __glutFinishMenu(Window win, int x, int y);
00434 extern void __glutMenuItemEnterOrLeave(GLUTmenuItem * item,
00435 int num, int type);
00436 extern void __glutPaintMenu(GLUTmenu * menu);
00437 extern void __glutSetMenu(GLUTmenu * menu);
00438 extern void __glutStartMenu(GLUTmenu * menu,
00439 GLUTwindow * window, int x, int y, int x_win, int y_win);
00440
00441
00442 extern void __glutWarning(char *format,...);
00443 extern void __glutFatalError(char *format,...);
00444 extern void __glutFatalUsage(char *format,...);
00445
00446
00447 extern GLUTwindow *__glutGetWindow(Window win);
00448 extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
00449 extern void __glutChangeWindowEventMask(long mask, Bool add);
00450 extern void __glutEstablishColormapsProperty(
00451 GLUTwindow * window);
00452 extern XVisualInfo *__glutDetermineVisual(
00453 unsigned int mode,
00454 Bool * fakeSingle,
00455 XVisualInfo * (getVisualInfo) (unsigned int));
00456 extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
00457 extern void __glutSetWindow(GLUTwindow * window);
00458 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
00459 int callingConvention);
00460 extern void __glutDefaultReshape(int, int);
00461 extern void __glutSetupColormap(
00462 XVisualInfo * vi,
00463 GLUTcolormap ** colormap,
00464 Colormap * cmap);
00465
00466
00467 extern int __glutIsSupportedByGLX(char *);
00468
00469
00470 extern void __glutUpdateInputDeviceMask(GLUTwindow * window);
00471
00472 #endif