4 /* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
6 /* This program is freely distributable without licensing fees
7 and is provided without guarantee or warrantee expressed or
8 implied. This program is -not- in the public domain. */
10 #if defined(__CYGWIN32__)
15 #include "glutwin32.h"
16 #elif !defined(__BEOS__)
18 #define SUPPORT_FORTRAN
21 #include <X11/Xutil.h>
27 /* Non-Win32 platforms need APIENTRY defined to nothing
28 because all the GLUT routines have the APIENTRY prefix
29 to make Win32 happy. */
35 #if ( __VMS_VER < 70000000 )
39 extern int sys$
gettim(struct timeval
*);
44 #include <sys/types.h>
51 #if defined(__vms) && ( __VMS_VER < 70000000 )
53 /* For VMS6.2 or lower :
54 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
55 0.0001 milliseconds. This means that there are 0.01
56 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
59 #define TICKS_PER_MILLISECOND 10000
60 #define TICKS_PER_SECOND 10000000
62 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
64 #define ADD_TIME(dest, src1, src2) { \
65 (dest).val = (src1).val + (src2).val; \
68 #define TIMEDELTA(dest, src1, src2) { \
69 (dest).val = (src1).val - (src2).val; \
72 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
74 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
77 #if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
79 #define GETTIMEOFDAY(_x) gettimeofday(_x)
81 #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
83 #define ADD_TIME(dest, src1, src2) { \
84 if(((dest).tv_usec = \
85 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
86 (dest).tv_usec -= 1000000; \
87 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
89 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
90 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
91 (dest).tv_sec --;(dest).tv_usec += 1000000; \
95 #define TIMEDELTA(dest, src1, src2) { \
96 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
97 (dest).tv_usec += 1000000; \
98 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
100 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
103 #define IS_AFTER(t1, t2) \
104 (((t2).tv_sec > (t1).tv_sec) || \
105 (((t2).tv_sec == (t1).tv_sec) && \
106 ((t2).tv_usec > (t1).tv_usec)))
107 #define IS_AT_OR_AFTER(t1, t2) \
108 (((t2).tv_sec > (t1).tv_sec) || \
109 (((t2).tv_sec == (t1).tv_sec) && \
110 ((t2).tv_usec >= (t1).tv_usec)))
113 #define IGNORE_IN_GAME_MODE() \
114 { if (__glutGameModeWindow) return; }
116 /* BeOS doesn't need most of this file */
119 #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
120 #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
121 #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
122 #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
123 #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
124 #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
125 #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
126 #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
127 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
128 #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
129 #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
130 #define GLUT_MAP_WORK (1 << 0)
131 #define GLUT_EVENT_MASK_WORK (1 << 1)
132 #define GLUT_REDISPLAY_WORK (1 << 2)
133 #define GLUT_CONFIGURE_WORK (1 << 3)
134 #define GLUT_COLORMAP_WORK (1 << 4)
135 #define GLUT_DEVICE_MASK_WORK (1 << 5)
136 #define GLUT_FINISH_WORK (1 << 6)
137 #define GLUT_DEBUG_WORK (1 << 7)
138 #define GLUT_DUMMY_WORK (1 << 8)
139 #define GLUT_FULL_SCREEN_WORK (1 << 9)
140 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
141 #define GLUT_REPAIR_WORK (1 << 11)
142 #define GLUT_OVERLAY_REPAIR_WORK (1 << 12)
144 /* Frame buffer capability macros and types. */
146 #define BUFFER_SIZE 1
147 #define DOUBLEBUFFER 2
149 #define AUX_BUFFERS 4
150 #define RED_SIZE 5 /* Used as mask bit for
156 #define STENCIL_SIZE 10
157 #define ACCUM_RED_SIZE 11 /* Used as mask bit for
159 #define ACCUM_GREEN_SIZE 12
160 #define ACCUM_BLUE_SIZE 13
161 #define ACCUM_ALPHA_SIZE 14
164 #define NUM_GLXCAPS (LEVEL + 1)
166 #define XVISUAL (NUM_GLXCAPS + 0)
167 #define TRANSPARENT (NUM_GLXCAPS + 1)
168 #define SAMPLES (NUM_GLXCAPS + 2)
169 #define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as
174 #define XGRAYSCALE (NUM_GLXCAPS + 4)
175 #define XSTATICCOLOR (NUM_GLXCAPS + 5)
176 #define XPSEUDOCOLOR (NUM_GLXCAPS + 6)
177 #define XTRUECOLOR (NUM_GLXCAPS + 7)
178 #define XDIRECTCOLOR (NUM_GLXCAPS + 8)
179 #define SLOW (NUM_GLXCAPS + 9)
180 #define CONFORMANT (NUM_GLXCAPS + 10)
182 #define NUM_CAPS (NUM_GLXCAPS + 11)
184 /* Frame buffer capablities that don't have a corresponding
185 FrameBufferMode entry. These get used as mask bits. */
186 #define NUM (NUM_CAPS + 0)
187 #define RGBA_MODE (NUM_CAPS + 1)
188 #define CI_MODE (NUM_CAPS + 2)
189 #define LUMINANCE_MODE (NUM_CAPS + 3)
200 typedef struct _Criterion
{
206 typedef struct _FrameBufferMode
{
208 #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
210 /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
211 (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
212 the visual's fbconfig is OpenGL-capable. The reason for this is typically
213 an RGBA luminance fbconfig such as 16-bit StaticGray that could
214 not be advertised as a GLX visual since StaticGray visuals are
215 required (by the GLX specification) to be color index. The
216 SGIX_fbconfig allows StaticGray visuals to instead advertised as
217 fbconfigs that can provide RGBA luminance support. */
225 /* DisplayMode capability macros for game mode. */
226 #define DM_WIDTH 0 /* "width" */
227 #define DM_HEIGHT 1 /* "height" */
228 #define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */
229 #define DM_HERTZ 3 /* "hertz" */
230 #define DM_NUM 4 /* "num" */
232 #define NUM_DM_CAPS (DM_NUM+1)
234 typedef struct _DisplayMode
{
238 /* XXX The X Window System does not have a standard
239 mechanism for display setting changes. On SGI
240 systems, GLUT could use the XSGIvc (SGI X video
241 control extension). Perhaps this can be done in
242 a future release of GLUT. */
245 int cap
[NUM_DM_CAPS
];
250 /* GLUT function types */
251 typedef void (*GLUTdisplayCB
) (void);
252 typedef void (*GLUTreshapeCB
) (int, int);
253 typedef void (*GLUTkeyboardCB
) (unsigned char, int, int);
254 typedef void (*GLUTmouseCB
) (int, int, int, int);
255 typedef void (*GLUTmotionCB
) (int, int);
256 typedef void (*GLUTpassiveCB
) (int, int);
257 typedef void (*GLUTentryCB
) (int);
258 typedef void (*GLUTvisibilityCB
) (int);
259 typedef void (*GLUTwindowStatusCB
) (int);
260 typedef void (*GLUTidleCB
) (void);
261 typedef void (*GLUTtimerCB
) (int);
262 typedef void (*GLUTmenuStateCB
) (int); /* DEPRICATED. */
263 typedef void (*GLUTmenuStatusCB
) (int, int, int);
264 typedef void (*GLUTselectCB
) (int);
265 typedef void (*GLUTspecialCB
) (int, int, int);
266 typedef void (*GLUTspaceMotionCB
) (int, int, int);
267 typedef void (*GLUTspaceRotateCB
) (int, int, int);
268 typedef void (*GLUTspaceButtonCB
) (int, int);
269 typedef void (*GLUTdialsCB
) (int, int);
270 typedef void (*GLUTbuttonBoxCB
) (int, int);
271 typedef void (*GLUTtabletMotionCB
) (int, int);
272 typedef void (*GLUTtabletButtonCB
) (int, int, int, int);
273 typedef void (*GLUTjoystickCB
) (unsigned int buttonMask
, int x
, int y
, int z
);
274 #ifdef SUPPORT_FORTRAN
275 typedef void (*GLUTdisplayFCB
) (void);
276 typedef void (*GLUTreshapeFCB
) (int *, int *);
277 /* NOTE the pressed key is int, not unsigned char for Fortran! */
278 typedef void (*GLUTkeyboardFCB
) (int *, int *, int *);
279 typedef void (*GLUTmouseFCB
) (int *, int *, int *, int *);
280 typedef void (*GLUTmotionFCB
) (int *, int *);
281 typedef void (*GLUTpassiveFCB
) (int *, int *);
282 typedef void (*GLUTentryFCB
) (int *);
283 typedef void (*GLUTvisibilityFCB
) (int *);
284 typedef void (*GLUTwindowStatusFCB
) (int *);
285 typedef void (*GLUTidleFCB
) (void);
286 typedef void (*GLUTtimerFCB
) (int *);
287 typedef void (*GLUTmenuStateFCB
) (int *); /* DEPRICATED. */
288 typedef void (*GLUTmenuStatusFCB
) (int *, int *, int *);
289 typedef void (*GLUTselectFCB
) (int *);
290 typedef void (*GLUTspecialFCB
) (int *, int *, int *);
291 typedef void (*GLUTspaceMotionFCB
) (int *, int *, int *);
292 typedef void (*GLUTspaceRotateFCB
) (int *, int *, int *);
293 typedef void (*GLUTspaceButtonFCB
) (int *, int *);
294 typedef void (*GLUTdialsFCB
) (int *, int *);
295 typedef void (*GLUTbuttonBoxFCB
) (int *, int *);
296 typedef void (*GLUTtabletMotionFCB
) (int *, int *);
297 typedef void (*GLUTtabletButtonFCB
) (int *, int *, int *, int *);
298 typedef void (*GLUTjoystickFCB
) (unsigned int *buttonMask
, int *x
, int *y
, int *z
);
303 typedef struct _GLUTcolorcell GLUTcolorcell
;
304 struct _GLUTcolorcell
{
305 /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
306 GLfloat component
[3];
309 typedef struct _GLUTcolormap GLUTcolormap
;
310 struct _GLUTcolormap
{
311 Visual
*visual
; /* visual of the colormap */
312 Colormap cmap
; /* X colormap ID */
313 int refcnt
; /* number of windows using colormap */
314 int size
; /* number of cells in colormap */
315 int transparent
; /* transparent pixel, or -1 if opaque */
316 GLUTcolorcell
*cells
; /* array of cells */
317 GLUTcolormap
*next
; /* next colormap in list */
320 typedef struct _GLUTwindow GLUTwindow
;
321 typedef struct _GLUToverlay GLUToverlay
;
323 int num
; /* Small integer window id (0-based). */
325 /* Window system related state. */
327 int pf
; /* Pixel format. */
328 HDC hdc
; /* Window's Win32 device context. */
330 Window win
; /* X window for GLUT window */
331 GLXContext ctx
; /* OpenGL context GLUT glut window */
332 XVisualInfo
*vis
; /* visual for window */
333 Bool visAlloced
; /* if vis needs deallocate on destroy */
334 Colormap cmap
; /* RGB colormap for window; None if CI */
335 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
336 GLUToverlay
*overlay
; /* overlay; NULL if no overlay */
338 HDC renderDc
; /* Win32's device context for rendering. */
340 Window renderWin
; /* X window for rendering (might be
342 GLXContext renderCtx
; /* OpenGL context for rendering (might
344 /* GLUT settable or visible window state. */
345 int width
; /* window width in pixels */
346 int height
; /* window height in pixels */
347 int cursor
; /* cursor name */
348 int visState
; /* visibility state (-1 is unknown) */
349 int shownState
; /* if window mapped */
350 int entryState
; /* entry state (-1 is unknown) */
351 #define GLUT_MAX_MENUS 3
353 int menu
[GLUT_MAX_MENUS
]; /* attatched menu nums */
354 /* Window relationship state. */
355 GLUTwindow
*parent
; /* parent window */
356 GLUTwindow
*children
; /* list of children */
357 GLUTwindow
*siblings
; /* list of siblings */
358 /* Misc. non-API visible (hidden) state. */
359 Bool treatAsSingle
; /* treat this window as single-buffered
360 (it might be "fake" though) */
361 Bool forceReshape
; /* force reshape before display */
363 Bool isDirect
; /* if direct context (X11 only) */
365 Bool usedSwapBuffers
; /* if swap buffers used last display */
366 long eventMask
; /* mask of X events selected for */
367 int buttonUses
; /* number of button uses, ref cnt */
368 int tabletPos
[2]; /* tablet position (-1 is invalid) */
369 /* Work list related state. */
370 unsigned int workMask
; /* mask of window work to be done */
371 GLUTwindow
*prevWorkWin
; /* link list of windows to work on */
372 Bool desiredMapState
; /* how to mapped window if on map work
374 Bool ignoreKeyRepeat
; /* if window ignores autorepeat */
375 int desiredConfMask
; /* mask of desired window configuration
377 int desiredX
; /* desired X location */
378 int desiredY
; /* desired Y location */
379 int desiredWidth
; /* desired window width */
380 int desiredHeight
; /* desired window height */
381 int desiredStack
; /* desired window stack */
382 /* Per-window callbacks. */
383 GLUTdisplayCB display
; /* redraw */
384 GLUTreshapeCB reshape
; /* resize (width,height) */
385 GLUTmouseCB mouse
; /* mouse (button,state,x,y) */
386 GLUTmotionCB motion
; /* motion (x,y) */
387 GLUTpassiveCB passive
; /* passive motion (x,y) */
388 GLUTentryCB entry
; /* window entry/exit (state) */
389 GLUTkeyboardCB keyboard
; /* keyboard (ASCII,x,y) */
390 GLUTkeyboardCB keyboardUp
; /* keyboard up (ASCII,x,y) */
391 GLUTwindowStatusCB windowStatus
; /* window status */
392 GLUTvisibilityCB visibility
; /* visibility */
393 GLUTspecialCB special
; /* special key */
394 GLUTspecialCB specialUp
; /* special up key */
395 GLUTbuttonBoxCB buttonBox
; /* button box */
396 GLUTdialsCB dials
; /* dials */
397 GLUTspaceMotionCB spaceMotion
; /* Spaceball motion */
398 GLUTspaceRotateCB spaceRotate
; /* Spaceball rotate */
399 GLUTspaceButtonCB spaceButton
; /* Spaceball button */
400 GLUTtabletMotionCB tabletMotion
; /* tablet motion */
401 GLUTtabletButtonCB tabletButton
; /* tablet button */
403 GLUTjoystickCB joystick
; /* joystick */
404 int joyPollInterval
; /* joystick polling interval */
406 #ifdef SUPPORT_FORTRAN
407 /* Special Fortran display unneeded since no
409 GLUTreshapeFCB freshape
; /* Fortran reshape */
410 GLUTmouseFCB fmouse
; /* Fortran mouse */
411 GLUTmotionFCB fmotion
; /* Fortran motion */
412 GLUTpassiveFCB fpassive
; /* Fortran passive */
413 GLUTentryFCB fentry
; /* Fortran entry */
414 GLUTkeyboardFCB fkeyboard
; /* Fortran keyboard */
415 GLUTkeyboardFCB fkeyboardUp
; /* Fortran keyboard up */
416 GLUTwindowStatusFCB fwindowStatus
; /* Fortran visibility
418 GLUTvisibilityFCB fvisibility
; /* Fortran visibility
420 GLUTspecialFCB fspecial
; /* special key */
421 GLUTspecialFCB fspecialUp
; /* special key up */
422 GLUTbuttonBoxFCB fbuttonBox
; /* button box */
423 GLUTdialsFCB fdials
; /* dials */
424 GLUTspaceMotionFCB fspaceMotion
; /* Spaceball motion
426 GLUTspaceRotateFCB fspaceRotate
; /* Spaceball rotate
428 GLUTspaceButtonFCB fspaceButton
; /* Spaceball button
430 GLUTtabletMotionFCB ftabletMotion
; /* tablet motion
432 GLUTtabletButtonFCB ftabletButton
; /* tablet button
435 GLUTjoystickFCB fjoystick
; /* joystick */
440 struct _GLUToverlay
{
447 XVisualInfo
*vis
; /* visual for window */
448 Bool visAlloced
; /* if vis needs deallocate on destroy */
449 Colormap cmap
; /* RGB colormap for window; None if CI */
450 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
451 int shownState
; /* if overlay window mapped */
452 Bool treatAsSingle
; /* treat as single-buffered */
454 Bool isDirect
; /* if direct context */
456 int transparentPixel
; /* transparent pixel value */
457 GLUTdisplayCB display
; /* redraw */
458 /* Special Fortran display unneeded since no
462 typedef struct _GLUTstale GLUTstale
;
469 extern GLUTstale
*__glutStaleWindowList
;
471 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
473 StructureNotifyMask | \
476 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
477 (ButtonReleaseMask | \
481 PointerMotionMask | \
482 Button1MotionMask | \
483 Button2MotionMask | \
485 #define GLUT_HACK_STOP_PROPAGATE_MASK \
489 typedef struct _GLUTmenu GLUTmenu
;
490 typedef struct _GLUTmenuItem GLUTmenuItem
;
492 int id
; /* small integer menu id (0-based) */
493 Window win
; /* X window for the menu */
494 GLUTselectCB select
; /* function of menu */
495 GLUTmenuItem
*list
; /* list of menu entries */
496 int num
; /* number of entries */
498 Bool managed
; /* are the InputOnly windows size
500 Bool searched
; /* help detect menu loops */
501 int pixheight
; /* height of menu in pixels */
502 int pixwidth
; /* width of menu in pixels */
504 int submenus
; /* number of submenu entries */
505 GLUTmenuItem
*highlighted
; /* pointer to highlighted menu
506 entry, NULL not highlighted */
507 GLUTmenu
*cascade
; /* currently cascading this menu */
508 GLUTmenuItem
*anchor
; /* currently anchored to this entry */
509 int x
; /* current x origin relative to the
511 int y
; /* current y origin relative to the
513 #ifdef SUPPORT_FORTRAN
514 GLUTselectFCB fselect
; /* function of menu */
518 struct _GLUTmenuItem
{
519 Window win
; /* InputOnly X window for entry */
520 GLUTmenu
*menu
; /* menu entry belongs to */
521 Bool isTrigger
; /* is a submenu trigger? */
522 int value
; /* value to return for selecting this
523 entry; doubles as submenu id
524 (0-base) if submenu trigger */
526 UINT unique
; /* unique menu item id (Win32 only) */
528 char *label
; /* __glutStrdup'ed label string */
529 int len
; /* length of label string */
530 int pixwidth
; /* width of X window in pixels */
531 GLUTmenuItem
*next
; /* next menu entry on list for menu */
534 typedef struct _GLUTtimer GLUTtimer
;
536 GLUTtimer
*next
; /* list of timers */
537 struct timeval timeout
; /* time to be called */
538 GLUTtimerCB func
; /* timer (value) */
539 int value
; /* return value */
540 #ifdef SUPPORT_FORTRAN
541 GLUTtimerFCB ffunc
; /* Fortran timer */
545 typedef struct _GLUTeventParser GLUTeventParser
;
546 struct _GLUTeventParser
{
547 int (*func
) (XEvent
*);
548 GLUTeventParser
*next
;
551 /* Declarations to implement glutFullScreen support with
554 /* The following X property format is defined in Motif 1.1's
555 Xm/MwmUtils.h, but GLUT should not depend on that header
556 file. Note: Motif 1.2 expanded this structure with
557 uninteresting fields (to GLUT) so just stick with the
558 smaller Motif 1.1 structure. */
560 #define MWM_HINTS_DECORATIONS 2
567 /* Make current and buffer swap macros. */
569 #define MAKE_CURRENT_LAYER(window) \
571 HGLRC currentContext = wglGetCurrentContext(); \
572 HDC currentDc = wglGetCurrentDC(); \
574 if (currentContext != window->renderCtx \
575 || currentDc != window->renderDc) { \
576 wglMakeCurrent(window->renderDc, window->renderCtx); \
579 #define MAKE_CURRENT_WINDOW(window) \
581 HGLRC currentContext = wglGetCurrentContext(); \
582 HDC currentDc = wglGetCurrentDC(); \
584 if (currentContext != window->ctx || currentDc != window->hdc) { \
585 wglMakeCurrent(window->hdc, window->ctx); \
588 #define MAKE_CURRENT_OVERLAY(overlay) \
589 wglMakeCurrent(overlay->hdc, overlay->ctx)
590 #define UNMAKE_CURRENT() \
591 wglMakeCurrent(NULL, NULL)
592 #define SWAP_BUFFERS_WINDOW(window) \
593 SwapBuffers(window->hdc)
594 #define SWAP_BUFFERS_LAYER(window) \
595 SwapBuffers(window->renderDc)
597 #define MAKE_CURRENT_LAYER(window) \
598 glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
599 #define MAKE_CURRENT_WINDOW(window) \
600 glXMakeCurrent(__glutDisplay, window->win, window->ctx)
601 #define MAKE_CURRENT_OVERLAY(overlay) \
602 glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
603 #define UNMAKE_CURRENT() \
604 glXMakeCurrent(__glutDisplay, None, NULL)
605 #define SWAP_BUFFERS_WINDOW(window) \
606 glXSwapBuffers(__glutDisplay, window->win)
607 #define SWAP_BUFFERS_LAYER(window) \
608 glXSwapBuffers(__glutDisplay, window->renderWin)
611 /* private variables from glut_event.c */
612 extern GLUTwindow
*__glutWindowWorkList
;
613 extern int __glutWindowDamaged
;
614 #ifdef SUPPORT_FORTRAN
615 extern GLUTtimer
*__glutTimerList
;
616 extern GLUTtimer
*__glutNewTimer
;
618 extern GLUTmenu
*__glutMappedMenu
;
620 extern void (*__glutUpdateInputDeviceMaskFunc
) (GLUTwindow
*);
622 extern void (*__glutMenuItemEnterOrLeave
)(GLUTmenuItem
* item
,
624 extern void (*__glutFinishMenu
)(Window win
, int x
, int y
);
625 extern void (*__glutPaintMenu
)(GLUTmenu
* menu
);
626 extern void (*__glutStartMenu
)(GLUTmenu
* menu
,
627 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
628 extern GLUTmenu
* (*__glutGetMenuByNum
)(int menunum
);
629 extern GLUTmenuItem
* (*__glutGetMenuItem
)(GLUTmenu
* menu
,
630 Window win
, int *which
);
631 extern GLUTmenu
* (*__glutGetMenu
)(Window win
);
634 /* private variables from glut_init.c */
635 extern Atom __glutWMDeleteWindow
;
636 extern Display
*__glutDisplay
;
637 extern unsigned int __glutDisplayMode
;
638 extern char *__glutDisplayString
;
639 extern XVisualInfo
*(*__glutDetermineVisualFromString
) (char *string
, Bool
* treatAsSingle
,
640 Criterion
* requiredCriteria
, int nRequired
, int requiredMask
, void **fbc
);
641 extern GLboolean __glutDebug
;
642 extern GLboolean __glutForceDirect
;
643 extern GLboolean __glutIconic
;
644 extern GLboolean __glutTryDirect
;
645 extern Window __glutRoot
;
646 extern XSizeHints __glutSizeHints
;
647 extern char **__glutArgv
;
649 extern char *__glutProgramName
;
651 extern int __glutArgc
;
652 extern int __glutConnectionFD
;
653 extern int __glutInitHeight
;
654 extern int __glutInitWidth
;
655 extern int __glutInitX
;
656 extern int __glutInitY
;
657 extern int __glutScreen
;
658 extern int __glutScreenHeight
;
659 extern int __glutScreenWidth
;
660 extern Atom __glutMotifHints
;
661 extern unsigned int __glutModifierMask
;
663 /* private variables from glut_menu.c */
664 extern GLUTmenuItem
*__glutItemSelected
;
665 extern GLUTmenu
**__glutMenuList
;
666 extern void (*__glutMenuStatusFunc
) (int, int, int);
667 extern void __glutMenuModificationError(void);
668 extern void __glutSetMenuItem(GLUTmenuItem
* item
,
669 const char *label
, int value
, Bool isTrigger
);
671 /* private variables from glut_win.c */
672 extern GLUTwindow
**__glutWindowList
;
673 extern GLUTwindow
*__glutCurrentWindow
;
674 extern GLUTwindow
*__glutMenuWindow
;
675 extern GLUTmenu
*__glutCurrentMenu
;
676 extern int __glutWindowListSize
;
677 extern void (*__glutFreeOverlayFunc
) (GLUToverlay
*);
678 extern XVisualInfo
*__glutDetermineWindowVisual(Bool
* treatAsSingle
,
679 Bool
* visAlloced
, void **fbc
);
681 /* private variables from glut_mesa.c */
682 extern int __glutMesaSwapHackSupport
;
684 /* private variables from glut_gamemode.c */
685 extern GLUTwindow
*__glutGameModeWindow
;
687 /* private routines from glut_cindex.c */
688 extern GLUTcolormap
* __glutAssociateNewColormap(XVisualInfo
* vis
);
689 extern void __glutFreeColormap(GLUTcolormap
*);
691 /* private routines from glut_cmap.c */
692 extern void __glutSetupColormap(
694 GLUTcolormap
** colormap
,
697 extern void __glutEstablishColormapsProperty(
698 GLUTwindow
* window
);
699 extern GLUTwindow
*__glutToplevelOf(GLUTwindow
* window
);
702 /* private routines from glut_cursor.c */
703 extern void __glutSetCursor(GLUTwindow
*window
);
705 /* private routines from glut_event.c */
706 extern void __glutPutOnWorkList(GLUTwindow
* window
,
708 extern void __glutRegisterEventParser(GLUTeventParser
* parser
);
709 extern void __glutPostRedisplay(GLUTwindow
* window
, int layerMask
);
711 /* private routines from glut_init.c */
713 extern void __glutOpenXConnection(char *display
);
715 extern void __glutOpenWin32Connection(char *display
);
717 extern void __glutInitTime(struct timeval
*beginning
);
719 /* private routines for glut_menu.c (or win32_menu.c) */
721 extern GLUTmenu
*__glutGetMenu(Window win
);
722 extern GLUTmenu
*__glutGetMenuByNum(int menunum
);
723 extern GLUTmenuItem
*__glutGetMenuItem(GLUTmenu
* menu
,
724 Window win
, int *which
);
725 extern void __glutStartMenu(GLUTmenu
* menu
,
726 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
727 extern void __glutFinishMenu(Window win
, int x
, int y
);
729 extern void __glutSetMenu(GLUTmenu
* menu
);
735 /* private routines from glut_util.c */
736 extern char * __glutStrdup(const char *string
);
737 extern void __glutWarning(char *format
,...);
738 extern void __glutFatalError(char *format
,...);
739 extern void __glutFatalUsage(char *format
,...);
745 /* private routines from glut_win.c */
746 extern GLUTwindow
*__glutGetWindow(Window win
);
747 extern void __glutChangeWindowEventMask(long mask
, Bool add
);
748 extern XVisualInfo
*__glutDetermineVisual(
751 XVisualInfo
* (getVisualInfo
) (unsigned int));
752 extern XVisualInfo
*__glutGetVisualInfo(unsigned int mode
);
753 extern void __glutSetWindow(GLUTwindow
* window
);
754 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc
,
755 int callingConvention
);
756 extern void __glutDefaultReshape(int, int);
757 extern GLUTwindow
*__glutCreateWindow(
759 int x
, int y
, int width
, int height
, int gamemode
);
760 extern void __glutDestroyWindow(
762 GLUTwindow
* initialWindow
);
765 /* private routines from glut_glxext.c */
766 extern int __glutIsSupportedByGLX(char *);
769 /* private routines from glut_input.c */
770 extern void __glutUpdateInputDeviceMask(GLUTwindow
* window
);
772 /* private routines from glut_mesa.c */
773 extern void __glutDetermineMesaSwapHackSupport(void);
775 /* private routines from glut_gameglut.c */
776 extern void __glutCloseDownGameMode(void);
779 /* private routines from win32_*.c */
780 extern LONG WINAPI
__glutWindowProc(HWND win
, UINT msg
, WPARAM w
, LPARAM l
);
785 /* BeOS specific C++ function prototypes */
788 #include <SupportDefs.h>
790 /* private routines from glutInit.cpp */
791 void __glutInitTime(bigtime_t
*beginning
);
794 /* private routines from glutMenu.cpp */
795 class GlutMenu
; // avoid including glutMenu.h
796 GlutMenu
*__glutGetMenuByNum(int menunum
);
798 /* private routines from glutWindow.cpp */
799 int __glutConvertDisplayMode(unsigned long *options
);
800 void __glutDefaultReshape(int width
, int height
);
801 class GlutWindow
; // avoid including glutWindow.h in every source file
802 void __glutSetWindow(GlutWindow
* window
);
803 void __glutDestroyAllWindows();
805 /* private routines from glutDstr.cpp */
806 int __glutConvertDisplayModeFromString(unsigned long *options
);
808 /* private routines from glutCursor.cpp */
809 void __glutSetCursor(int cursor
);
811 #endif /* __cplusplus */
814 #endif /* __glutint_h__ */