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__)
14 #define SUPPORT_FORTRAN /* With GLUT 3.7, everyone supports Fortran. */
17 #include "glutwin32.h"
20 #include <X11/Xutil.h>
24 /* added by BrianP: */
25 #define APIENTRY GLAPIENTRY
26 #define __cdecl GLAPIENTRY
27 #define CDECL GLAPIENTRY
30 #define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
32 /* GLUT_BUILDING_LIB is used by <GL/glut.h> to 1) not #pragma link
33 with the GLUT library, and 2) avoid the Win32 atexit hack. */
37 /* This must be done after <GL/gl.h> is included. MESA is defined
38 if the <GL/gl.h> is supplied by Brian Paul's Mesa library. */
39 #if defined(MESA) && defined(_WIN32)
40 /* Mesa implements "wgl" versions of GDI entry points needed for
41 using OpenGL. Map these "wgl" versions to the GDI names via
43 GLAPI
int GLAPIENTRY
wglChoosePixelFormat(HDC hdc
, CONST PIXELFORMATDESCRIPTOR
*ppfd
);
44 GLAPI
int GLAPIENTRY
wglDescribePixelFormat(HDC hdc
,int iPixelFormat
,UINT nBytes
, LPPIXELFORMATDESCRIPTOR ppfd
);
45 GLAPI
int GLAPIENTRY
wglGetPixelFormat(HDC hdc
);
46 GLAPI BOOL GLAPIENTRY
wglSetPixelFormat(HDC hdc
, int iPixelFormat
, CONST PIXELFORMATDESCRIPTOR
*ppfd
);
47 GLAPI BOOL GLAPIENTRY
wglSwapBuffers(HDC hdc
);
48 GLAPI HGLRC GLWINAPI
wglCreateContext(HDC hdc
);
49 GLAPI BOOL GLWINAPI
wglDeleteContext(HGLRC hglrc
);
50 GLAPI HGLRC GLWINAPI
wglGetCurrentContext(VOID
);
51 GLAPI HDC GLWINAPI
wglGetCurrentDC(VOID
);
52 GLAPI BOOL GLWINAPI
wglMakeCurrent(HDC hdc
,HGLRC hglrc
);
53 #define ChoosePixelFormat wglChoosePixelFormat
54 #define DescribePixelFormat wglDescribePixelFormat
55 #define GetPixelFormat wglGetPixelFormat
56 #define SetPixelFormat wglSetPixelFormat
57 #define SwapBuffers wglSwapBuffers
58 #define GetCurrentContext wglGetCurrentContext
59 #define GetCurrentDC wglGetCurrentDC
60 #define MakeCurrent wglMakeCurrent
61 #define CreateContext wglCreateContext
62 #define DeleteContext wglDeleteContext
65 #ifdef SUPPORT_FORTRAN
66 #include <GL/glutf90.h>
70 #if ( __VMS_VER < 70000000 )
74 extern int sys$
gettim(struct timeval
*);
79 #include <sys/types.h>
86 #if defined(__vms) && ( __VMS_VER < 70000000 )
88 /* For VMS6.2 or lower :
89 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
90 0.0001 milliseconds. This means that there are 0.01
91 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
94 #define TICKS_PER_MILLISECOND 10000
95 #define TICKS_PER_SECOND 10000000
97 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
99 #define ADD_TIME(dest, src1, src2) { \
100 (dest).val = (src1).val + (src2).val; \
103 #define TIMEDELTA(dest, src1, src2) { \
104 (dest).val = (src1).val - (src2).val; \
107 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
109 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
112 #if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
114 #define GETTIMEOFDAY(_x) gettimeofday(_x)
116 #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
118 #define ADD_TIME(dest, src1, src2) { \
119 if(((dest).tv_usec = \
120 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
121 (dest).tv_usec -= 1000000; \
122 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
124 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
125 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
126 (dest).tv_sec --;(dest).tv_usec += 1000000; \
130 #define TIMEDELTA(dest, src1, src2) { \
131 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
132 (dest).tv_usec += 1000000; \
133 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
135 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
138 #define IS_AFTER(t1, t2) \
139 (((t2).tv_sec > (t1).tv_sec) || \
140 (((t2).tv_sec == (t1).tv_sec) && \
141 ((t2).tv_usec > (t1).tv_usec)))
142 #define IS_AT_OR_AFTER(t1, t2) \
143 (((t2).tv_sec > (t1).tv_sec) || \
144 (((t2).tv_sec == (t1).tv_sec) && \
145 ((t2).tv_usec >= (t1).tv_usec)))
148 #define IGNORE_IN_GAME_MODE() \
149 { if (__glutGameModeWindow) return; }
151 #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
152 #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
153 #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
154 #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
155 #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
156 #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
157 #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
158 #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
159 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
160 #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
161 #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
162 #define GLUT_MAP_WORK (1 << 0)
163 #define GLUT_EVENT_MASK_WORK (1 << 1)
164 #define GLUT_REDISPLAY_WORK (1 << 2)
165 #define GLUT_CONFIGURE_WORK (1 << 3)
166 #define GLUT_COLORMAP_WORK (1 << 4)
167 #define GLUT_DEVICE_MASK_WORK (1 << 5)
168 #define GLUT_FINISH_WORK (1 << 6)
169 #define GLUT_DEBUG_WORK (1 << 7)
170 #define GLUT_DUMMY_WORK (1 << 8)
171 #define GLUT_FULL_SCREEN_WORK (1 << 9)
172 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
173 #define GLUT_REPAIR_WORK (1 << 11)
174 #define GLUT_OVERLAY_REPAIR_WORK (1 << 12)
176 /* Frame buffer capability macros and types. */
178 #define BUFFER_SIZE 1
179 #define DOUBLEBUFFER 2
181 #define AUX_BUFFERS 4
182 #define RED_SIZE 5 /* Used as mask bit for
188 #define STENCIL_SIZE 10
189 #define ACCUM_RED_SIZE 11 /* Used as mask bit for
191 #define ACCUM_GREEN_SIZE 12
192 #define ACCUM_BLUE_SIZE 13
193 #define ACCUM_ALPHA_SIZE 14
196 #define NUM_GLXCAPS (LEVEL + 1)
198 #define XVISUAL (NUM_GLXCAPS + 0)
199 #define TRANSPARENT (NUM_GLXCAPS + 1)
200 #define SAMPLES (NUM_GLXCAPS + 2)
201 #define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as
206 #define XGRAYSCALE (NUM_GLXCAPS + 4)
207 #define XSTATICCOLOR (NUM_GLXCAPS + 5)
208 #define XPSEUDOCOLOR (NUM_GLXCAPS + 6)
209 #define XTRUECOLOR (NUM_GLXCAPS + 7)
210 #define XDIRECTCOLOR (NUM_GLXCAPS + 8)
211 #define SLOW (NUM_GLXCAPS + 9)
212 #define CONFORMANT (NUM_GLXCAPS + 10)
214 #define NUM_CAPS (NUM_GLXCAPS + 11)
216 /* Frame buffer capablities that don't have a corresponding
217 FrameBufferMode entry. These get used as mask bits. */
218 #define NUM (NUM_CAPS + 0)
219 #define RGBA_MODE (NUM_CAPS + 1)
220 #define CI_MODE (NUM_CAPS + 2)
221 #define LUMINANCE_MODE (NUM_CAPS + 3)
232 typedef struct _Criterion
{
238 typedef struct _FrameBufferMode
{
240 #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
242 /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
243 (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
244 the visual's fbconfig is OpenGL-capable. The reason for this is typically
245 an RGBA luminance fbconfig such as 16-bit StaticGray that could
246 not be advertised as a GLX visual since StaticGray visuals are
247 required (by the GLX specification) to be color index. The
248 SGIX_fbconfig allows StaticGray visuals to instead advertised as
249 fbconfigs that can provide RGBA luminance support. */
257 /* DisplayMode capability macros for game mode. */
258 #define DM_WIDTH 0 /* "width" */
259 #define DM_HEIGHT 1 /* "height" */
260 #define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */
261 #define DM_HERTZ 3 /* "hertz" */
262 #define DM_NUM 4 /* "num" */
264 #define NUM_DM_CAPS (DM_NUM+1)
266 typedef struct _DisplayMode
{
270 /* XXX The X Window System does not have a standard
271 mechanism for display setting changes. On SGI
272 systems, GLUT could use the XSGIvc (SGI X video
273 control extension). Perhaps this can be done in
274 a future release of GLUT. */
277 int cap
[NUM_DM_CAPS
];
280 /* GLUT function types */
281 typedef void (GLUTCALLBACK
*GLUTdisplayCB
) (void);
282 typedef void (GLUTCALLBACK
*GLUTreshapeCB
) (int, int);
283 typedef void (GLUTCALLBACK
*GLUTkeyboardCB
) (unsigned char, int, int);
284 typedef void (GLUTCALLBACK
*GLUTmouseCB
) (int, int, int, int);
285 typedef void (GLUTCALLBACK
*GLUTmotionCB
) (int, int);
286 typedef void (GLUTCALLBACK
*GLUTpassiveCB
) (int, int);
287 typedef void (GLUTCALLBACK
*GLUTentryCB
) (int);
288 typedef void (GLUTCALLBACK
*GLUTvisibilityCB
) (int);
289 typedef void (GLUTCALLBACK
*GLUTwindowStatusCB
) (int);
290 typedef void (GLUTCALLBACK
*GLUTidleCB
) (void);
291 typedef void (GLUTCALLBACK
*GLUTtimerCB
) (int);
292 typedef void (GLUTCALLBACK
*GLUTmenuStateCB
) (int); /* DEPRICATED. */
293 typedef void (GLUTCALLBACK
*GLUTmenuStatusCB
) (int, int, int);
294 typedef void (GLUTCALLBACK
*GLUTselectCB
) (int);
295 typedef void (GLUTCALLBACK
*GLUTspecialCB
) (int, int, int);
296 typedef void (GLUTCALLBACK
*GLUTspaceMotionCB
) (int, int, int);
297 typedef void (GLUTCALLBACK
*GLUTspaceRotateCB
) (int, int, int);
298 typedef void (GLUTCALLBACK
*GLUTspaceButtonCB
) (int, int);
299 typedef void (GLUTCALLBACK
*GLUTdialsCB
) (int, int);
300 typedef void (GLUTCALLBACK
*GLUTbuttonBoxCB
) (int, int);
301 typedef void (GLUTCALLBACK
*GLUTtabletMotionCB
) (int, int);
302 typedef void (GLUTCALLBACK
*GLUTtabletButtonCB
) (int, int, int, int);
303 typedef void (GLUTCALLBACK
*GLUTjoystickCB
) (unsigned int buttonMask
, int x
, int y
, int z
);
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 GLUTdisplayFCB fdisplay
; /* Fortran display */
410 GLUTreshapeFCB freshape
; /* Fortran reshape */
411 GLUTmouseFCB fmouse
; /* Fortran mouse */
412 GLUTmotionFCB fmotion
; /* Fortran motion */
413 GLUTpassiveFCB fpassive
; /* Fortran passive */
414 GLUTentryFCB fentry
; /* Fortran entry */
415 GLUTkeyboardFCB fkeyboard
; /* Fortran keyboard */
416 GLUTkeyboardFCB fkeyboardUp
; /* Fortran keyboard up */
417 GLUTwindowStatusFCB fwindowStatus
; /* Fortran window status */
418 GLUTvisibilityFCB fvisibility
; /* Fortran visibility */
419 GLUTspecialFCB fspecial
; /* special key */
420 GLUTspecialFCB fspecialUp
; /* special key up */
421 GLUTbuttonBoxFCB fbuttonBox
; /* button box */
422 GLUTdialsFCB fdials
; /* dials */
423 GLUTspaceMotionFCB fspaceMotion
; /* Spaceball motion */
424 GLUTspaceRotateFCB fspaceRotate
; /* Spaceball rotate */
425 GLUTspaceButtonFCB fspaceButton
; /* Spaceball button */
426 GLUTtabletMotionFCB ftabletMotion
; /* tablet motion */
427 GLUTtabletButtonFCB ftabletButton
; /* tablet button */
429 GLUTjoystickFCB fjoystick
; /* joystick */
434 struct _GLUToverlay
{
441 XVisualInfo
*vis
; /* visual for window */
442 Bool visAlloced
; /* if vis needs deallocate on destroy */
443 Colormap cmap
; /* RGB colormap for window; None if CI */
444 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
445 int shownState
; /* if overlay window mapped */
446 Bool treatAsSingle
; /* treat as single-buffered */
448 Bool isDirect
; /* if direct context */
450 int transparentPixel
; /* transparent pixel value */
451 GLUTdisplayCB display
; /* redraw */
452 #ifdef SUPPORT_FORTRAN
453 GLUTdisplayFCB fdisplay
; /* redraw */
457 typedef struct _GLUTstale GLUTstale
;
464 extern GLUTstale
*__glutStaleWindowList
;
466 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
468 StructureNotifyMask | \
471 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
472 (ButtonReleaseMask | \
476 PointerMotionMask | \
477 Button1MotionMask | \
478 Button2MotionMask | \
480 #define GLUT_HACK_STOP_PROPAGATE_MASK \
484 typedef struct _GLUTmenu GLUTmenu
;
485 typedef struct _GLUTmenuItem GLUTmenuItem
;
487 int id
; /* small integer menu id (0-based) */
488 Window win
; /* X window for the menu */
489 GLUTselectCB select
; /* function of menu */
490 GLUTmenuItem
*list
; /* list of menu entries */
491 int num
; /* number of entries */
493 Bool managed
; /* are the InputOnly windows size
495 Bool searched
; /* help detect menu loops */
496 int pixheight
; /* height of menu in pixels */
497 int pixwidth
; /* width of menu in pixels */
499 int submenus
; /* number of submenu entries */
500 GLUTmenuItem
*highlighted
; /* pointer to highlighted menu
501 entry, NULL not highlighted */
502 GLUTmenu
*cascade
; /* currently cascading this menu */
503 GLUTmenuItem
*anchor
; /* currently anchored to this entry */
504 int x
; /* current x origin relative to the
506 int y
; /* current y origin relative to the
508 #ifdef SUPPORT_FORTRAN
509 GLUTselectFCB fselect
; /* function of menu */
513 struct _GLUTmenuItem
{
514 Window win
; /* InputOnly X window for entry */
515 GLUTmenu
*menu
; /* menu entry belongs to */
516 Bool isTrigger
; /* is a submenu trigger? */
517 int value
; /* value to return for selecting this
518 entry; doubles as submenu id
519 (0-base) if submenu trigger */
521 UINT unique
; /* unique menu item id (Win32 only) */
523 char *label
; /* __glutStrdup'ed label string */
524 int len
; /* length of label string */
525 int pixwidth
; /* width of X window in pixels */
526 GLUTmenuItem
*next
; /* next menu entry on list for menu */
529 typedef struct _GLUTtimer GLUTtimer
;
531 GLUTtimer
*next
; /* list of timers */
532 struct timeval timeout
; /* time to be called */
533 GLUTtimerCB func
; /* timer (value) */
534 int value
; /* return value */
535 #ifdef SUPPORT_FORTRAN
536 GLUTtimerFCB ffunc
; /* Fortran timer */
540 typedef struct _GLUTeventParser GLUTeventParser
;
541 struct _GLUTeventParser
{
542 int (*func
) (XEvent
*);
543 GLUTeventParser
*next
;
546 /* Declarations to implement glutFullScreen support with
549 /* The following X property format is defined in Motif 1.1's
550 Xm/MwmUtils.h, but GLUT should not depend on that header
551 file. Note: Motif 1.2 expanded this structure with
552 uninteresting fields (to GLUT) so just stick with the
553 smaller Motif 1.1 structure. */
555 #define MWM_HINTS_DECORATIONS 2
562 /* Make current and buffer swap macros. */
564 #define MAKE_CURRENT_LAYER(window) \
566 HGLRC currentContext = GetCurrentContext(); \
567 HDC currentDc = GetCurrentDC(); \
569 if (currentContext != window->renderCtx \
570 || currentDc != window->renderDc) { \
571 MakeCurrent(window->renderDc, window->renderCtx); \
574 #define MAKE_CURRENT_WINDOW(window) \
576 HGLRC currentContext = GetCurrentContext(); \
577 HDC currentDc = GetCurrentDC(); \
579 if (currentContext != window->ctx || currentDc != window->hdc) { \
580 MakeCurrent(window->hdc, window->ctx); \
583 #define MAKE_CURRENT_OVERLAY(overlay) \
584 MakeCurrent(overlay->hdc, overlay->ctx)
585 #define UNMAKE_CURRENT() \
586 MakeCurrent(NULL, NULL)
587 #define SWAP_BUFFERS_WINDOW(window) \
588 SwapBuffers(window->hdc)
589 #define SWAP_BUFFERS_LAYER(window) \
590 SwapBuffers(window->renderDc)
592 #define MAKE_CURRENT_LAYER(window) \
593 glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
594 #define MAKE_CURRENT_WINDOW(window) \
595 glXMakeCurrent(__glutDisplay, window->win, window->ctx)
596 #define MAKE_CURRENT_OVERLAY(overlay) \
597 glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
598 #define UNMAKE_CURRENT() \
599 glXMakeCurrent(__glutDisplay, None, NULL)
600 #define SWAP_BUFFERS_WINDOW(window) \
601 glXSwapBuffers(__glutDisplay, window->win)
602 #define SWAP_BUFFERS_LAYER(window) \
603 glXSwapBuffers(__glutDisplay, window->renderWin)
606 /* private variables from glut_event.c */
607 extern GLUTwindow
*__glutWindowWorkList
;
608 extern int __glutWindowDamaged
;
609 #ifdef SUPPORT_FORTRAN
610 extern GLUTtimer
*__glutTimerList
;
611 extern GLUTtimer
*__glutNewTimer
;
613 extern GLUTmenu
*__glutMappedMenu
;
615 extern void (*__glutUpdateInputDeviceMaskFunc
) (GLUTwindow
*);
617 extern void (*__glutMenuItemEnterOrLeave
)(GLUTmenuItem
* item
,
619 extern void (*__glutFinishMenu
)(Window win
, int x
, int y
);
620 extern void (*__glutPaintMenu
)(GLUTmenu
* menu
);
621 extern void (*__glutStartMenu
)(GLUTmenu
* menu
,
622 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
623 extern GLUTmenu
* (*__glutGetMenuByNum
)(int menunum
);
624 extern GLUTmenuItem
* (*__glutGetMenuItem
)(GLUTmenu
* menu
,
625 Window win
, int *which
);
626 extern GLUTmenu
* (*__glutGetMenu
)(Window win
);
629 /* private variables from glut_init.c */
630 extern Atom __glutWMDeleteWindow
;
631 extern Display
*__glutDisplay
;
632 extern unsigned int __glutDisplayMode
;
633 extern char *__glutDisplayString
;
634 extern XVisualInfo
*(*__glutDetermineVisualFromString
) (char *string
, Bool
* treatAsSingle
,
635 Criterion
* requiredCriteria
, int nRequired
, int requiredMask
, void **fbc
);
636 extern GLboolean __glutDebug
;
637 extern GLboolean __glutForceDirect
;
638 extern GLboolean __glutIconic
;
639 extern GLboolean __glutTryDirect
;
640 extern Window __glutRoot
;
641 extern XSizeHints __glutSizeHints
;
642 extern char **__glutArgv
;
643 extern char *__glutProgramName
;
644 extern int __glutArgc
;
645 extern int __glutConnectionFD
;
646 extern int __glutInitHeight
;
647 extern int __glutInitWidth
;
648 extern int __glutInitX
;
649 extern int __glutInitY
;
650 extern int __glutScreen
;
651 extern int __glutScreenHeight
;
652 extern int __glutScreenWidth
;
653 extern Atom __glutMotifHints
;
654 extern unsigned int __glutModifierMask
;
656 extern void (__cdecl
*__glutExitFunc
)(int retval
);
659 /* private variables from glut_menu.c */
660 extern GLUTmenuItem
*__glutItemSelected
;
661 extern GLUTmenu
**__glutMenuList
;
662 extern void (GLUTCALLBACK
*__glutMenuStatusFunc
) (int, int, int);
663 extern void __glutMenuModificationError(void);
664 extern void __glutSetMenuItem(GLUTmenuItem
* item
,
665 const char *label
, int value
, Bool isTrigger
);
667 /* private variables from glut_win.c */
668 extern GLUTwindow
**__glutWindowList
;
669 extern GLUTwindow
*__glutCurrentWindow
;
670 extern GLUTwindow
*__glutMenuWindow
;
671 extern GLUTmenu
*__glutCurrentMenu
;
672 extern int __glutWindowListSize
;
673 extern void (*__glutFreeOverlayFunc
) (GLUToverlay
*);
674 extern XVisualInfo
*__glutDetermineWindowVisual(Bool
* treatAsSingle
,
675 Bool
* visAlloced
, void **fbc
);
677 /* private variables from glut_mesa.c */
678 extern int __glutMesaSwapHackSupport
;
680 /* private variables from glut_gamemode.c */
681 extern GLUTwindow
*__glutGameModeWindow
;
683 /* private routines from glut_cindex.c */
684 extern GLUTcolormap
* __glutAssociateNewColormap(XVisualInfo
* vis
);
685 extern void __glutFreeColormap(GLUTcolormap
*);
687 /* private routines from glut_cmap.c */
688 extern void __glutSetupColormap(
690 GLUTcolormap
** colormap
,
693 extern void __glutEstablishColormapsProperty(
694 GLUTwindow
* window
);
695 extern GLUTwindow
*__glutToplevelOf(GLUTwindow
* window
);
698 /* private routines from glut_cursor.c */
699 extern void __glutSetCursor(GLUTwindow
*window
);
701 /* private routines from glut_event.c */
702 extern void __glutPutOnWorkList(GLUTwindow
* window
,
704 extern void __glutRegisterEventParser(GLUTeventParser
* parser
);
705 extern void __glutPostRedisplay(GLUTwindow
* window
, int layerMask
);
707 /* private routines from glut_init.c */
709 extern void __glutOpenXConnection(char *display
);
711 extern void __glutOpenWin32Connection(char *display
);
713 extern void __glutInitTime(struct timeval
*beginning
);
715 /* private routines for glut_menu.c (or win32_menu.c) */
717 extern GLUTmenu
*__glutGetMenu(Window win
);
718 extern GLUTmenu
*__glutGetMenuByNum(int menunum
);
719 extern GLUTmenuItem
*__glutGetMenuItem(GLUTmenu
* menu
,
720 Window win
, int *which
);
721 extern void __glutStartMenu(GLUTmenu
* menu
,
722 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
723 extern void __glutFinishMenu(Window win
, int x
, int y
);
725 extern void __glutSetMenu(GLUTmenu
* menu
);
727 /* private routines from glut_util.c */
728 extern char * __glutStrdup(const char *string
);
729 extern void __glutWarning(char *format
,...);
730 extern void __glutFatalError(char *format
,...);
731 extern void __glutFatalUsage(char *format
,...);
733 /* private routines from glut_win.c */
734 extern GLUTwindow
*__glutGetWindow(Window win
);
735 extern void __glutChangeWindowEventMask(long mask
, Bool add
);
736 extern XVisualInfo
*__glutDetermineVisual(
739 XVisualInfo
* (getVisualInfo
) (unsigned int));
740 extern XVisualInfo
*__glutGetVisualInfo(unsigned int mode
);
741 extern void __glutSetWindow(GLUTwindow
* window
);
742 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc
,
743 int callingConvention
);
744 extern void GLUTCALLBACK
__glutDefaultReshape(int, int);
745 extern GLUTwindow
*__glutCreateWindow(
747 int x
, int y
, int width
, int height
, int gamemode
);
748 extern void __glutDestroyWindow(
750 GLUTwindow
* initialWindow
);
753 /* private routines from glut_glxext.c */
754 extern int __glutIsSupportedByGLX(char *);
757 /* private routines from glut_input.c */
758 extern void __glutUpdateInputDeviceMask(GLUTwindow
* window
);
760 /* private routines from glut_mesa.c */
761 extern void __glutDetermineMesaSwapHackSupport(void);
763 /* private routines from glut_gameglut.c */
764 extern void GLUTAPIENTRYV
__glutCloseDownGameMode(void);
767 /* private routines from win32_*.c */
768 extern LONG WINAPI
__glutWindowProc(HWND win
, UINT msg
, WPARAM w
, LPARAM l
);
772 #endif /* __glutint_h__ */