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. */
11 #include <GL/vms_x_fix.h>
14 #if defined(__CYGWIN32__)
18 #define SUPPORT_FORTRAN /* With GLUT 3.7, everyone supports Fortran. */
21 #include "glutwin32.h"
24 #include <X11/Xutil.h>
25 #define GLX_GLXEXT_PROTOTYPES
29 #define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
32 #if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
33 #include <gl/mesa_wgl.h>
37 /* added by BrianP: */
39 #define APIENTRY GLAPIENTRY
41 #define __cdecl GLAPIENTRY
42 #define CDECL GLAPIENTRY
45 /* GLUT_BUILDING_LIB is used by <GL/glut.h> to 1) not #pragma link
46 with the GLUT library, and 2) avoid the Win32 atexit hack. */
48 /* This must be done after <GL/gl.h> is included. MESA is defined
49 if the <GL/gl.h> is supplied by Brian Paul's Mesa library. */
50 #if defined(MESA) && defined(_WIN32)
51 /* Mesa implements "wgl" versions of GDI entry points needed for
52 using OpenGL. Map these "wgl" versions to the GDI names via
54 #define ChoosePixelFormat wglChoosePixelFormat
55 #define DescribePixelFormat wglDescribePixelFormat
56 #define GetPixelFormat wglGetPixelFormat
57 #define SetPixelFormat wglSetPixelFormat
58 #define SwapBuffers wglSwapBuffers
59 #define GetCurrentContext wglGetCurrentContext
60 #define GetCurrentDC wglGetCurrentDC
61 #define MakeCurrent wglMakeCurrent
62 #define CreateContext wglCreateContext
63 #define DeleteContext wglDeleteContext
66 #ifdef SUPPORT_FORTRAN
67 #include <GL/glutf90.h>
71 #if ( __VMS_VER < 70000000 )
76 extern int sys$
gettim(struct timeval6
*);
81 #include <sys/types.h>
82 #if !defined(_WIN32) || defined(__CYGWIN32__)
88 #if defined(__vms) && ( __VMS_VER < 70000000 )
90 /* For VMS6.2 or lower :
91 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
92 0.0001 milliseconds. This means that there are 0.01
93 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
96 #define TICKS_PER_MILLISECOND 10000
97 #define TICKS_PER_SECOND 10000000
99 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
101 #define ADD_TIME(dest, src1, src2) { \
102 (dest).val = (src1).val + (src2).val; \
105 #define TIMEDELTA(dest, src1, src2) { \
106 (dest).val = (src1).val - (src2).val; \
109 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
111 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
114 #if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
116 #define GETTIMEOFDAY(_x) gettimeofday(_x)
118 #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
120 #define ADD_TIME(dest, src1, src2) { \
121 if(((dest).tv_usec = \
122 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
123 (dest).tv_usec -= 1000000; \
124 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
126 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
127 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
128 (dest).tv_sec --;(dest).tv_usec += 1000000; \
132 #define TIMEDELTA(dest, src1, src2) { \
133 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
134 (dest).tv_usec += 1000000; \
135 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
137 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
140 #define IS_AFTER(t1, t2) \
141 (((t2).tv_sec > (t1).tv_sec) || \
142 (((t2).tv_sec == (t1).tv_sec) && \
143 ((t2).tv_usec > (t1).tv_usec)))
144 #define IS_AT_OR_AFTER(t1, t2) \
145 (((t2).tv_sec > (t1).tv_sec) || \
146 (((t2).tv_sec == (t1).tv_sec) && \
147 ((t2).tv_usec >= (t1).tv_usec)))
150 #define IGNORE_IN_GAME_MODE() \
151 { if (__glutGameModeWindow) return; }
153 #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
154 #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
155 #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
156 #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
157 #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
158 #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
159 #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
160 #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
161 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
162 #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
163 #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
164 #define GLUT_MAP_WORK (1 << 0)
165 #define GLUT_EVENT_MASK_WORK (1 << 1)
166 #define GLUT_REDISPLAY_WORK (1 << 2)
167 #define GLUT_CONFIGURE_WORK (1 << 3)
168 #define GLUT_COLORMAP_WORK (1 << 4)
169 #define GLUT_DEVICE_MASK_WORK (1 << 5)
170 #define GLUT_FINISH_WORK (1 << 6)
171 #define GLUT_DEBUG_WORK (1 << 7)
172 #define GLUT_DUMMY_WORK (1 << 8)
173 #define GLUT_FULL_SCREEN_WORK (1 << 9)
174 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
175 #define GLUT_REPAIR_WORK (1 << 11)
176 #define GLUT_OVERLAY_REPAIR_WORK (1 << 12)
178 /* Frame buffer capability macros and types. */
180 #define BUFFER_SIZE 1
181 #define DOUBLEBUFFER 2
183 #define AUX_BUFFERS 4
184 #define RED_SIZE 5 /* Used as mask bit for
190 #define STENCIL_SIZE 10
191 #define ACCUM_RED_SIZE 11 /* Used as mask bit for
193 #define ACCUM_GREEN_SIZE 12
194 #define ACCUM_BLUE_SIZE 13
195 #define ACCUM_ALPHA_SIZE 14
198 #define NUM_GLXCAPS (LEVEL + 1)
200 #define XVISUAL (NUM_GLXCAPS + 0)
201 #define TRANSPARENT (NUM_GLXCAPS + 1)
202 #define SAMPLES (NUM_GLXCAPS + 2)
203 #define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as
208 #define XGRAYSCALE (NUM_GLXCAPS + 4)
209 #define XSTATICCOLOR (NUM_GLXCAPS + 5)
210 #define XPSEUDOCOLOR (NUM_GLXCAPS + 6)
211 #define XTRUECOLOR (NUM_GLXCAPS + 7)
212 #define XDIRECTCOLOR (NUM_GLXCAPS + 8)
213 #define SLOW (NUM_GLXCAPS + 9)
214 #define CONFORMANT (NUM_GLXCAPS + 10)
216 #define NUM_CAPS (NUM_GLXCAPS + 11)
218 /* Frame buffer capablities that don't have a corresponding
219 FrameBufferMode entry. These get used as mask bits. */
220 #define NUM (NUM_CAPS + 0)
221 #define RGBA_MODE (NUM_CAPS + 1)
222 #define CI_MODE (NUM_CAPS + 2)
223 #define LUMINANCE_MODE (NUM_CAPS + 3)
234 typedef struct _Criterion
{
240 typedef struct _FrameBufferMode
{
242 #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
244 /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
245 (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
246 the visual's fbconfig is OpenGL-capable. The reason for this is typically
247 an RGBA luminance fbconfig such as 16-bit StaticGray that could
248 not be advertised as a GLX visual since StaticGray visuals are
249 required (by the GLX specification) to be color index. The
250 SGIX_fbconfig allows StaticGray visuals to instead advertised as
251 fbconfigs that can provide RGBA luminance support. */
259 /* DisplayMode capability macros for game mode. */
260 #define DM_WIDTH 0 /* "width" */
261 #define DM_HEIGHT 1 /* "height" */
262 #define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */
263 #define DM_HERTZ 3 /* "hertz" */
264 #define DM_NUM 4 /* "num" */
266 #define NUM_DM_CAPS (DM_NUM+1)
268 typedef struct _DisplayMode
{
272 /* XXX The X Window System does not have a standard
273 mechanism for display setting changes. On SGI
274 systems, GLUT could use the XSGIvc (SGI X video
275 control extension). Perhaps this can be done in
276 a future release of GLUT. */
279 int cap
[NUM_DM_CAPS
];
282 /* GLUT function types */
283 typedef void (GLUTCALLBACK
*GLUTdisplayCB
) (void);
284 typedef void (GLUTCALLBACK
*GLUTreshapeCB
) (int, int);
285 typedef void (GLUTCALLBACK
*GLUTkeyboardCB
) (unsigned char, int, int);
286 typedef void (GLUTCALLBACK
*GLUTmouseCB
) (int, int, int, int);
287 typedef void (GLUTCALLBACK
*GLUTmotionCB
) (int, int);
288 typedef void (GLUTCALLBACK
*GLUTpassiveCB
) (int, int);
289 typedef void (GLUTCALLBACK
*GLUTentryCB
) (int);
290 typedef void (GLUTCALLBACK
*GLUTvisibilityCB
) (int);
291 typedef void (GLUTCALLBACK
*GLUTwindowStatusCB
) (int);
292 typedef void (GLUTCALLBACK
*GLUTidleCB
) (void);
293 typedef void (GLUTCALLBACK
*GLUTtimerCB
) (int);
294 typedef void (GLUTCALLBACK
*GLUTmenuStateCB
) (int); /* DEPRICATED. */
295 typedef void (GLUTCALLBACK
*GLUTmenuStatusCB
) (int, int, int);
296 typedef void (GLUTCALLBACK
*GLUTselectCB
) (int);
297 typedef void (GLUTCALLBACK
*GLUTspecialCB
) (int, int, int);
298 typedef void (GLUTCALLBACK
*GLUTspaceMotionCB
) (int, int, int);
299 typedef void (GLUTCALLBACK
*GLUTspaceRotateCB
) (int, int, int);
300 typedef void (GLUTCALLBACK
*GLUTspaceButtonCB
) (int, int);
301 typedef void (GLUTCALLBACK
*GLUTdialsCB
) (int, int);
302 typedef void (GLUTCALLBACK
*GLUTbuttonBoxCB
) (int, int);
303 typedef void (GLUTCALLBACK
*GLUTtabletMotionCB
) (int, int);
304 typedef void (GLUTCALLBACK
*GLUTtabletButtonCB
) (int, int, int, int);
305 typedef void (GLUTCALLBACK
*GLUTjoystickCB
) (unsigned int buttonMask
, int x
, int y
, int z
);
307 typedef struct _GLUTcolorcell GLUTcolorcell
;
308 struct _GLUTcolorcell
{
309 /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
310 GLfloat component
[3];
313 typedef struct _GLUTcolormap GLUTcolormap
;
314 struct _GLUTcolormap
{
315 Visual
*visual
; /* visual of the colormap */
316 Colormap cmap
; /* X colormap ID */
317 int refcnt
; /* number of windows using colormap */
318 int size
; /* number of cells in colormap */
319 int transparent
; /* transparent pixel, or -1 if opaque */
320 GLUTcolorcell
*cells
; /* array of cells */
321 GLUTcolormap
*next
; /* next colormap in list */
324 typedef struct _GLUTwindow GLUTwindow
;
325 typedef struct _GLUToverlay GLUToverlay
;
327 int num
; /* Small integer window id (0-based). */
329 /* Window system related state. */
331 int pf
; /* Pixel format. */
332 HDC hdc
; /* Window's Win32 device context. */
334 Window win
; /* X window for GLUT window */
335 GLXContext ctx
; /* OpenGL context GLUT glut window */
336 XVisualInfo
*vis
; /* visual for window */
337 Bool visAlloced
; /* if vis needs deallocate on destroy */
338 Colormap cmap
; /* RGB colormap for window; None if CI */
339 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
340 GLUToverlay
*overlay
; /* overlay; NULL if no overlay */
342 HDC renderDc
; /* Win32's device context for rendering. */
344 Window renderWin
; /* X window for rendering (might be
346 GLXContext renderCtx
; /* OpenGL context for rendering (might
348 /* GLUT settable or visible window state. */
349 int width
; /* window width in pixels */
350 int height
; /* window height in pixels */
351 int cursor
; /* cursor name */
352 int visState
; /* visibility state (-1 is unknown) */
353 int shownState
; /* if window mapped */
354 int entryState
; /* entry state (-1 is unknown) */
355 #define GLUT_MAX_MENUS 3
357 int menu
[GLUT_MAX_MENUS
]; /* attatched menu nums */
358 /* Window relationship state. */
359 GLUTwindow
*parent
; /* parent window */
360 GLUTwindow
*children
; /* list of children */
361 GLUTwindow
*siblings
; /* list of siblings */
362 /* Misc. non-API visible (hidden) state. */
363 Bool treatAsSingle
; /* treat this window as single-buffered
364 (it might be "fake" though) */
365 Bool forceReshape
; /* force reshape before display */
367 Bool isDirect
; /* if direct context (X11 only) */
369 Bool usedSwapBuffers
; /* if swap buffers used last display */
370 long eventMask
; /* mask of X events selected for */
371 int buttonUses
; /* number of button uses, ref cnt */
372 int tabletPos
[2]; /* tablet position (-1 is invalid) */
373 /* Work list related state. */
374 unsigned int workMask
; /* mask of window work to be done */
375 GLUTwindow
*prevWorkWin
; /* link list of windows to work on */
376 Bool desiredMapState
; /* how to mapped window if on map work
378 Bool ignoreKeyRepeat
; /* if window ignores autorepeat */
379 int desiredConfMask
; /* mask of desired window configuration
381 int desiredX
; /* desired X location */
382 int desiredY
; /* desired Y location */
383 int desiredWidth
; /* desired window width */
384 int desiredHeight
; /* desired window height */
385 int desiredStack
; /* desired window stack */
386 /* Per-window callbacks. */
387 GLUTdisplayCB display
; /* redraw */
388 GLUTreshapeCB reshape
; /* resize (width,height) */
389 GLUTmouseCB mouse
; /* mouse (button,state,x,y) */
390 GLUTmotionCB motion
; /* motion (x,y) */
391 GLUTpassiveCB passive
; /* passive motion (x,y) */
392 GLUTentryCB entry
; /* window entry/exit (state) */
393 GLUTkeyboardCB keyboard
; /* keyboard (ASCII,x,y) */
394 GLUTkeyboardCB keyboardUp
; /* keyboard up (ASCII,x,y) */
395 GLUTwindowStatusCB windowStatus
; /* window status */
396 GLUTvisibilityCB visibility
; /* visibility */
397 GLUTspecialCB special
; /* special key */
398 GLUTspecialCB specialUp
; /* special up key */
399 GLUTbuttonBoxCB buttonBox
; /* button box */
400 GLUTdialsCB dials
; /* dials */
401 GLUTspaceMotionCB spaceMotion
; /* Spaceball motion */
402 GLUTspaceRotateCB spaceRotate
; /* Spaceball rotate */
403 GLUTspaceButtonCB spaceButton
; /* Spaceball button */
404 GLUTtabletMotionCB tabletMotion
; /* tablet motion */
405 GLUTtabletButtonCB tabletButton
; /* tablet button */
407 GLUTjoystickCB joystick
; /* joystick */
408 int joyPollInterval
; /* joystick polling interval */
410 #ifdef SUPPORT_FORTRAN
411 GLUTdisplayFCB fdisplay
; /* Fortran display */
412 GLUTreshapeFCB freshape
; /* Fortran reshape */
413 GLUTmouseFCB fmouse
; /* Fortran mouse */
414 GLUTmotionFCB fmotion
; /* Fortran motion */
415 GLUTpassiveFCB fpassive
; /* Fortran passive */
416 GLUTentryFCB fentry
; /* Fortran entry */
417 GLUTkeyboardFCB fkeyboard
; /* Fortran keyboard */
418 GLUTkeyboardFCB fkeyboardUp
; /* Fortran keyboard up */
419 GLUTwindowStatusFCB fwindowStatus
; /* Fortran window status */
420 GLUTvisibilityFCB fvisibility
; /* Fortran visibility */
421 GLUTspecialFCB fspecial
; /* special key */
422 GLUTspecialFCB fspecialUp
; /* special key up */
423 GLUTbuttonBoxFCB fbuttonBox
; /* button box */
424 GLUTdialsFCB fdials
; /* dials */
425 GLUTspaceMotionFCB fspaceMotion
; /* Spaceball motion */
426 GLUTspaceRotateFCB fspaceRotate
; /* Spaceball rotate */
427 GLUTspaceButtonFCB fspaceButton
; /* Spaceball button */
428 GLUTtabletMotionFCB ftabletMotion
; /* tablet motion */
429 GLUTtabletButtonFCB ftabletButton
; /* tablet button */
431 GLUTjoystickFCB fjoystick
; /* joystick */
436 struct _GLUToverlay
{
443 XVisualInfo
*vis
; /* visual for window */
444 Bool visAlloced
; /* if vis needs deallocate on destroy */
445 Colormap cmap
; /* RGB colormap for window; None if CI */
446 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
447 int shownState
; /* if overlay window mapped */
448 Bool treatAsSingle
; /* treat as single-buffered */
450 Bool isDirect
; /* if direct context */
452 int transparentPixel
; /* transparent pixel value */
453 GLUTdisplayCB display
; /* redraw */
454 #ifdef SUPPORT_FORTRAN
455 GLUTdisplayFCB fdisplay
; /* redraw */
459 typedef struct _GLUTstale GLUTstale
;
466 extern GLUTstale
*__glutStaleWindowList
;
468 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
470 StructureNotifyMask | \
473 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
474 (ButtonReleaseMask | \
478 PointerMotionMask | \
479 Button1MotionMask | \
480 Button2MotionMask | \
482 #define GLUT_HACK_STOP_PROPAGATE_MASK \
486 typedef struct _GLUTmenu GLUTmenu
;
487 typedef struct _GLUTmenuItem GLUTmenuItem
;
489 int id
; /* small integer menu id (0-based) */
490 Window win
; /* X window for the menu */
491 GLUTselectCB select
; /* function of menu */
492 GLUTmenuItem
*list
; /* list of menu entries */
493 int num
; /* number of entries */
495 Bool managed
; /* are the InputOnly windows size
497 Bool searched
; /* help detect menu loops */
498 int pixheight
; /* height of menu in pixels */
499 int pixwidth
; /* width of menu in pixels */
501 int submenus
; /* number of submenu entries */
502 GLUTmenuItem
*highlighted
; /* pointer to highlighted menu
503 entry, NULL not highlighted */
504 GLUTmenu
*cascade
; /* currently cascading this menu */
505 GLUTmenuItem
*anchor
; /* currently anchored to this entry */
506 int x
; /* current x origin relative to the
508 int y
; /* current y origin relative to the
510 #ifdef SUPPORT_FORTRAN
511 GLUTselectFCB fselect
; /* function of menu */
515 struct _GLUTmenuItem
{
516 Window win
; /* InputOnly X window for entry */
517 GLUTmenu
*menu
; /* menu entry belongs to */
518 Bool isTrigger
; /* is a submenu trigger? */
519 int value
; /* value to return for selecting this
520 entry; doubles as submenu id
521 (0-base) if submenu trigger */
523 UINT unique
; /* unique menu item id (Win32 only) */
525 char *label
; /* __glutStrdup'ed label string */
526 int len
; /* length of label string */
527 int pixwidth
; /* width of X window in pixels */
528 GLUTmenuItem
*next
; /* next menu entry on list for menu */
531 typedef struct _GLUTtimer GLUTtimer
;
533 GLUTtimer
*next
; /* list of timers */
535 struct timeval6 timeout
; /* time to be called */
537 struct timeval timeout
; /* time to be called */
539 GLUTtimerCB func
; /* timer (value) */
540 int value
; /* return value */
541 #ifdef SUPPORT_FORTRAN
542 GLUTtimerFCB ffunc
; /* Fortran timer */
546 typedef struct _GLUTeventParser GLUTeventParser
;
547 struct _GLUTeventParser
{
548 int (*func
) (XEvent
*);
549 GLUTeventParser
*next
;
552 /* Declarations to implement glutFullScreen support with
555 /* The following X property format is defined in Motif 1.1's
556 Xm/MwmUtils.h, but GLUT should not depend on that header
557 file. Note: Motif 1.2 expanded this structure with
558 uninteresting fields (to GLUT) so just stick with the
559 smaller Motif 1.1 structure. */
561 #define MWM_HINTS_DECORATIONS 2
568 /* Make current and buffer swap macros. */
570 #define MAKE_CURRENT_LAYER(window) \
572 HGLRC currentContext = GetCurrentContext(); \
573 HDC currentDc = GetCurrentDC(); \
575 if (currentContext != window->renderCtx \
576 || currentDc != window->renderDc) { \
577 MakeCurrent(window->renderDc, window->renderCtx); \
580 #define MAKE_CURRENT_WINDOW(window) \
582 HGLRC currentContext = GetCurrentContext(); \
583 HDC currentDc = GetCurrentDC(); \
585 if (currentContext != window->ctx || currentDc != window->hdc) { \
586 MakeCurrent(window->hdc, window->ctx); \
589 #define MAKE_CURRENT_OVERLAY(overlay) \
590 MakeCurrent(overlay->hdc, overlay->ctx)
591 #define UNMAKE_CURRENT() \
592 MakeCurrent(NULL, NULL)
593 #define SWAP_BUFFERS_WINDOW(window) \
594 SwapBuffers(window->hdc)
595 #define SWAP_BUFFERS_LAYER(window) \
596 SwapBuffers(window->renderDc)
598 #define MAKE_CURRENT_LAYER(window) \
599 glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
600 #define MAKE_CURRENT_WINDOW(window) \
601 glXMakeCurrent(__glutDisplay, window->win, window->ctx)
602 #define MAKE_CURRENT_OVERLAY(overlay) \
603 glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
604 #define UNMAKE_CURRENT() \
605 glXMakeCurrent(__glutDisplay, None, NULL)
606 #define SWAP_BUFFERS_WINDOW(window) \
607 glXSwapBuffers(__glutDisplay, window->win)
608 #define SWAP_BUFFERS_LAYER(window) \
609 glXSwapBuffers(__glutDisplay, window->renderWin)
612 /* private variables from glut_event.c */
613 extern GLUTwindow
*__glutWindowWorkList
;
614 extern int __glutWindowDamaged
;
615 #ifdef SUPPORT_FORTRAN
616 extern GLUTtimer
*__glutTimerList
;
617 extern GLUTtimer
*__glutNewTimer
;
619 extern GLUTmenu
*__glutMappedMenu
;
621 extern void (*__glutUpdateInputDeviceMaskFunc
) (GLUTwindow
*);
623 extern void (*__glutMenuItemEnterOrLeave
)(GLUTmenuItem
* item
,
625 extern void (*__glutFinishMenu
)(Window win
, int x
, int y
);
626 extern void (*__glutPaintMenu
)(GLUTmenu
* menu
);
627 extern void (*__glutStartMenu
)(GLUTmenu
* menu
,
628 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
629 extern GLUTmenu
* (*__glutGetMenuByNum
)(int menunum
);
630 extern GLUTmenuItem
* (*__glutGetMenuItem
)(GLUTmenu
* menu
,
631 Window win
, int *which
);
632 extern GLUTmenu
* (*__glutGetMenu
)(Window win
);
635 /* private variables from glut_init.c */
636 extern Atom __glutWMDeleteWindow
;
637 extern Display
*__glutDisplay
;
638 extern unsigned int __glutDisplayMode
;
639 extern char *__glutDisplayString
;
640 extern XVisualInfo
*(*__glutDetermineVisualFromString
) (char *string
, Bool
* treatAsSingle
,
641 Criterion
* requiredCriteria
, int nRequired
, int requiredMask
, void **fbc
);
642 extern GLboolean __glutDebug
;
643 extern GLboolean __glutForceDirect
;
644 extern GLboolean __glutIconic
;
645 extern GLboolean __glutTryDirect
;
646 extern Window __glutRoot
;
647 extern XSizeHints __glutSizeHints
;
648 extern char **__glutArgv
;
649 extern char *__glutProgramName
;
650 extern int __glutArgc
;
651 extern int __glutConnectionFD
;
652 extern int __glutInitHeight
;
653 extern int __glutInitWidth
;
654 extern int __glutInitX
;
655 extern int __glutInitY
;
656 extern int __glutScreen
;
657 extern int __glutScreenHeight
;
658 extern int __glutScreenWidth
;
659 extern Atom __glutMotifHints
;
660 extern unsigned int __glutModifierMask
;
662 extern void (__cdecl
*__glutExitFunc
)(int retval
);
665 /* private variables from glut_menu.c */
666 extern GLUTmenuItem
*__glutItemSelected
;
667 extern GLUTmenu
**__glutMenuList
;
668 extern void (GLUTCALLBACK
*__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 void __glutFreeOverlay(GLUToverlay
* overlay
);
681 extern XVisualInfo
*__glutDetermineWindowVisual(Bool
* treatAsSingle
,
682 Bool
* visAlloced
, void **fbc
);
684 /* private variables from glut_mesa.c */
685 extern int __glutMesaSwapHackSupport
;
687 /* private variables from glut_gamemode.c */
688 extern GLUTwindow
*__glutGameModeWindow
;
690 /* private routines from glut_cindex.c */
691 extern GLUTcolormap
* __glutAssociateNewColormap(XVisualInfo
* vis
);
692 extern void __glutFreeColormap(GLUTcolormap
*);
694 /* private routines from glut_cmap.c */
695 extern void __glutSetupColormap(
697 GLUTcolormap
** colormap
,
700 extern void __glutEstablishColormapsProperty(
701 GLUTwindow
* window
);
702 extern GLUTwindow
*__glutToplevelOf(GLUTwindow
* window
);
705 /* private routines from glut_cursor.c */
706 extern void __glutSetCursor(GLUTwindow
*window
);
708 /* private routines from glut_event.c */
709 extern void __glutPutOnWorkList(GLUTwindow
* window
,
711 extern void __glutRegisterEventParser(GLUTeventParser
* parser
);
712 extern void __glutPostRedisplay(GLUTwindow
* window
, int layerMask
);
713 extern void handleTimeouts(void);
715 /* private routines from glut_init.c */
717 extern void __glutOpenXConnection(char *display
);
719 extern void __glutOpenWin32Connection(char *display
);
722 extern void __glutInitTime(struct timeval6
*beginning
);
724 extern void __glutInitTime(struct timeval
*beginning
);
727 /* private routines for glut_menu.c (or win32_menu.c) */
729 extern GLUTmenu
*__glutGetMenu(Window win
);
730 extern GLUTmenu
*__glutGetMenuByNum(int menunum
);
731 extern GLUTmenuItem
*__glutGetMenuItem(GLUTmenu
* menu
,
732 Window win
, int *which
);
733 extern void __glutStartMenu(GLUTmenu
* menu
,
734 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
735 extern void __glutFinishMenu(Window win
, int x
, int y
);
737 extern void __glutSetMenu(GLUTmenu
* menu
);
739 /* private routines from glut_util.c */
740 extern char * __glutStrdup(const char *string
);
741 extern void __glutWarning(char *format
,...);
742 extern void __glutFatalError(char *format
,...);
743 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 GLUTCALLBACK
__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 *);
767 extern int __glut_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
,
768 int channel
, Window window
);
769 extern int __glut_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
,
770 int x
, int y
, int w
, int h
);
771 extern int __glut_glXQueryChannelRectSGIX(Display
*dpy
, int screen
,
772 int channel
, int *x
, int *y
,
774 extern int __glut_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
,
775 int channel
, int *dx
, int *dy
,
777 extern int __glut_glXChannelRectSyncSGIX(Display
*dpy
, int screen
, int channel
,
779 extern GLXContext
__glut_glXCreateContextWithConfigSGIX(Display
*dpy
,
780 GLXFBConfigSGIX config
,
782 GLXContext share_list
,
784 extern int __glut_glXGetFBConfigAttribSGIX(Display
*dpy
,
785 GLXFBConfigSGIX config
,
788 extern GLXFBConfigSGIX
__glut_glXGetFBConfigFromVisualSGIX(Display
*dpy
,
792 /* private routines from glut_input.c */
793 extern void __glutUpdateInputDeviceMask(GLUTwindow
* window
);
795 /* private routines from glut_mesa.c */
796 extern void __glutDetermineMesaSwapHackSupport(void);
798 /* private routines from glut_gameglut.c */
799 extern void __glutCloseDownGameMode(void);
801 /* private variables from glut_swap.c (BrianP) */
802 extern GLint __glutFPS
;
803 extern GLint __glutSwapCount
;
804 extern GLint __glutSwapTime
;
807 /* private routines from win32_*.c */
808 extern LONG WINAPI
__glutWindowProc(HWND win
, UINT msg
, WPARAM w
, LPARAM l
);
812 #endif /* __glutint_h__ */