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