source: trunk/src/opengl/glut/glutint.h@ 2603

Last change on this file since 2603 was 2595, checked in by sandervl, 26 years ago

JvdH:Ported SGI GLUT sources + Opengl update

File size: 28.7 KB
Line 
1#ifndef __glutint_h__
2#define __glutint_h__
3
4/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
5
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. */
9
10#if defined(__CYGWIN32__)
11#include <sys/time.h>
12#endif
13
14#if defined(_WIN32)
15#include "glutwin32.h"
16#else
17#if defined(__WIN32OS2__)
18#include "glutos2.h"
19#else
20#ifdef __sgi
21#define SUPPORT_FORTRAN
22#endif
23#include <X11/Xlib.h>
24#include <X11/Xutil.h>
25#include <GL/glx.h>
26#endif
27#endif
28
29#include "glut.h"
30
31/* Non-Win32 platforms need APIENTRY defined to nothing
32 because all the GLUT routines have the APIENTRY prefix
33 to make Win32 happy. */
34#ifndef APIENTRY
35#define APIENTRY
36#endif
37
38#ifdef __vms
39#if ( __VMS_VER < 70000000 )
40struct timeval {
41 __int64 val;
42};
43extern int sys$gettim(struct timeval *);
44#else
45#include <time.h>
46#endif
47#else
48#include <sys/types.h>
49#if !defined(_WIN32)
50#include <sys/time.h>
51#else
52#include <winsock.h>
53#endif
54#endif
55#if defined(__vms) && ( __VMS_VER < 70000000 )
56
57/* For VMS6.2 or lower :
58 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
59 0.0001 milliseconds. This means that there are 0.01
60 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
61 ticks/second. */
62
63#define TICKS_PER_MILLISECOND 10000
64#define TICKS_PER_SECOND 10000000
65
66#define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
67
68#define ADD_TIME(dest, src1, src2) { \
69 (dest).val = (src1).val + (src2).val; \
70}
71
72#define TIMEDELTA(dest, src1, src2) { \
73 (dest).val = (src1).val - (src2).val; \
74}
75
76#define IS_AFTER(t1, t2) ((t2).val > (t1).val)
77
78#define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
79
80#else
81#if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
82 wants 2 args. */
83#define GETTIMEOFDAY(_x) gettimeofday(_x)
84#else
85#define GETTIMEOFDAY(_x) gettimeofday(_x, (void *)NULL)
86#endif
87#define ADD_TIME(dest, src1, src2) { \
88 if(((dest).tv_usec = \
89 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
90 (dest).tv_usec -= 1000000; \
91 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
92 } else { \
93 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
94 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
95 (dest).tv_sec --;(dest).tv_usec += 1000000; \
96 } \
97 } \
98}
99#define TIMEDELTA(dest, src1, src2) { \
100 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
101 (dest).tv_usec += 1000000; \
102 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
103 } else { \
104 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
105 } \
106}
107#define IS_AFTER(t1, t2) \
108 (((t2).tv_sec > (t1).tv_sec) || \
109 (((t2).tv_sec == (t1).tv_sec) && \
110 ((t2).tv_usec > (t1).tv_usec)))
111#define IS_AT_OR_AFTER(t1, t2) \
112 (((t2).tv_sec > (t1).tv_sec) || \
113 (((t2).tv_sec == (t1).tv_sec) && \
114 ((t2).tv_usec >= (t1).tv_usec)))
115#endif
116
117#define IGNORE_IN_GAME_MODE() \
118 { if (__glutGameModeWindow) return; }
119
120#define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
121#define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
122#define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
123#define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
124#define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
125#define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
126#define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
127#define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
128#define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
129#define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
130#define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
131#define GLUT_MAP_WORK (1 << 0)
132#define GLUT_EVENT_MASK_WORK (1 << 1)
133#define GLUT_REDISPLAY_WORK (1 << 2)
134#define GLUT_CONFIGURE_WORK (1 << 3)
135#define GLUT_COLORMAP_WORK (1 << 4)
136#define GLUT_DEVICE_MASK_WORK (1 << 5)
137#define GLUT_FINISH_WORK (1 << 6)
138#define GLUT_DEBUG_WORK (1 << 7)
139#define GLUT_DUMMY_WORK (1 << 8)
140#define GLUT_FULL_SCREEN_WORK (1 << 9)
141#define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
142#define GLUT_REPAIR_WORK (1 << 11)
143#define GLUT_OVERLAY_REPAIR_WORK (1 << 12)
144
145/* Frame buffer capability macros and types. */
146#define RGBA 0
147#define BUFFER_SIZE 1
148#define DOUBLEBUFFER 2
149#define STEREO 3
150#define AUX_BUFFERS 4
151#define RED_SIZE 5 /* Used as mask bit for
152 "color selected". */
153#define GREEN_SIZE 6
154#define BLUE_SIZE 7
155#define ALPHA_SIZE 8
156#define DEPTH_SIZE 9
157#define STENCIL_SIZE 10
158#define ACCUM_RED_SIZE 11 /* Used as mask bit for
159 "acc selected". */
160#define ACCUM_GREEN_SIZE 12
161#define ACCUM_BLUE_SIZE 13
162#define ACCUM_ALPHA_SIZE 14
163#define LEVEL 15
164
165#define NUM_GLXCAPS (LEVEL + 1)
166
167#define XVISUAL (NUM_GLXCAPS + 0)
168#define TRANSPARENT (NUM_GLXCAPS + 1)
169#define SAMPLES (NUM_GLXCAPS + 2)
170#define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as
171 mask bit
172 for "any
173 visual type
174 selected". */
175#define XGRAYSCALE (NUM_GLXCAPS + 4)
176#define XSTATICCOLOR (NUM_GLXCAPS + 5)
177#define XPSEUDOCOLOR (NUM_GLXCAPS + 6)
178#define XTRUECOLOR (NUM_GLXCAPS + 7)
179#define XDIRECTCOLOR (NUM_GLXCAPS + 8)
180#define SLOW (NUM_GLXCAPS + 9)
181#define CONFORMANT (NUM_GLXCAPS + 10)
182
183#define NUM_CAPS (NUM_GLXCAPS + 11)
184
185/* Frame buffer capablities that don't have a corresponding
186 FrameBufferMode entry. These get used as mask bits. */
187#define NUM (NUM_CAPS + 0)
188#define RGBA_MODE (NUM_CAPS + 1)
189#define CI_MODE (NUM_CAPS + 2)
190#define LUMINANCE_MODE (NUM_CAPS + 3)
191
192#define NONE 0
193#define EQ 1
194#define NEQ 2
195#define LTE 3
196#define GTE 4
197#define GT 5
198#define LT 6
199#define MIN_ 7
200
201typedef struct _Criterion {
202 int capability;
203 int comparison;
204 int value;
205} Criterion;
206
207typedef struct _FrameBufferMode {
208 XVisualInfo *vi;
209#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
210
211 /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
212 (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
213 the visual's fbconfig is OpenGL-capable. The reason for this is typically
214 an RGBA luminance fbconfig such as 16-bit StaticGray that could
215 not be advertised as a GLX visual since StaticGray visuals are
216 required (by the GLX specification) to be color index. The
217 SGIX_fbconfig allows StaticGray visuals to instead advertised as
218 fbconfigs that can provide RGBA luminance support. */
219
220 GLXFBConfigSGIX fbc;
221#endif
222 int valid;
223 int cap[NUM_CAPS];
224} FrameBufferMode;
225
226/* DisplayMode capability macros for game mode. */
227#define DM_WIDTH 0 /* "width" */
228#define DM_HEIGHT 1 /* "height" */
229#define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */
230#define DM_HERTZ 3 /* "hertz" */
231#define DM_NUM 4 /* "num" */
232
233#define NUM_DM_CAPS (DM_NUM+1)
234
235typedef struct _DisplayMode {
236#if defined(_WIN32)
237 DEVMODE devmode;
238#else
239#if defined(__WIN32OS2__)
240 DEVMODEA devmode;
241#else
242 /* XXX The X Window System does not have a standard
243 mechanism for display setting changes. On SGI
244 systems, GLUT could use the XSGIvc (SGI X video
245 control extension). Perhaps this can be done in
246 a future release of GLUT. */
247#endif
248#endif
249 int valid;
250 int cap[NUM_DM_CAPS];
251} DisplayMode;
252
253/* GLUT function types */
254typedef void (* APIENTRY GLUTdisplayCB) (void);
255typedef void (* APIENTRY GLUTreshapeCB) (int, int);
256typedef void (* APIENTRY GLUTkeyboardCB) (unsigned char, int, int);
257typedef void (* APIENTRY GLUTmouseCB) (int, int, int, int);
258typedef void (* APIENTRY GLUTmotionCB) (int, int);
259typedef void (* APIENTRY GLUTpassiveCB) (int, int);
260typedef void (* APIENTRY GLUTentryCB) (int);
261typedef void (* APIENTRY GLUTvisibilityCB) (int);
262typedef void (* APIENTRY GLUTwindowStatusCB) (int);
263typedef void (* APIENTRY GLUTidleCB) (void);
264typedef void (* APIENTRY GLUTtimerCB) (int);
265typedef void (* APIENTRY GLUTmenuStateCB) (int); /* DEPRICATED. */
266typedef void (* APIENTRY GLUTmenuStatusCB) (int, int, int);
267typedef void (* APIENTRY GLUTselectCB) (int);
268typedef void (* APIENTRY GLUTspecialCB) (int, int, int);
269typedef void (* APIENTRY GLUTspaceMotionCB) (int, int, int);
270typedef void (* APIENTRY GLUTspaceRotateCB) (int, int, int);
271typedef void (* APIENTRY GLUTspaceButtonCB) (int, int);
272typedef void (* APIENTRY GLUTdialsCB) (int, int);
273typedef void (* APIENTRY GLUTbuttonBoxCB) (int, int);
274typedef void (* APIENTRY GLUTtabletMotionCB) (int, int);
275typedef void (* APIENTRY GLUTtabletButtonCB) (int, int, int, int);
276typedef void (* APIENTRY GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
277#ifdef SUPPORT_FORTRAN
278typedef void (*GLUTdisplayFCB) (void);
279typedef void (*GLUTreshapeFCB) (int *, int *);
280/* NOTE the pressed key is int, not unsigned char for Fortran! */
281typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
282typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
283typedef void (*GLUTmotionFCB) (int *, int *);
284typedef void (*GLUTpassiveFCB) (int *, int *);
285typedef void (*GLUTentryFCB) (int *);
286typedef void (*GLUTvisibilityFCB) (int *);
287typedef void (*GLUTwindowStatusFCB) (int *);
288typedef void (*GLUTidleFCB) (void);
289typedef void (*GLUTtimerFCB) (int *);
290typedef void (*GLUTmenuStateFCB) (int *); /* DEPRICATED. */
291typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
292typedef void (*GLUTselectFCB) (int *);
293typedef void (*GLUTspecialFCB) (int *, int *, int *);
294typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
295typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
296typedef void (*GLUTspaceButtonFCB) (int *, int *);
297typedef void (*GLUTdialsFCB) (int *, int *);
298typedef void (*GLUTbuttonBoxFCB) (int *, int *);
299typedef void (*GLUTtabletMotionFCB) (int *, int *);
300typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
301typedef void (*GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
302#endif
303
304typedef struct _GLUTcolorcell GLUTcolorcell;
305struct _GLUTcolorcell {
306 /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
307 GLfloat component[3];
308};
309
310typedef struct _GLUTcolormap GLUTcolormap;
311struct _GLUTcolormap {
312 Visual *visual; /* visual of the colormap */
313 Colormap cmap; /* X colormap ID */
314 int refcnt; /* number of windows using colormap */
315 int size; /* number of cells in colormap */
316 int transparent; /* transparent pixel, or -1 if opaque */
317 GLUTcolorcell *cells; /* array of cells */
318 GLUTcolormap *next; /* next colormap in list */
319};
320
321typedef struct _GLUTwindow GLUTwindow;
322typedef struct _GLUToverlay GLUToverlay;
323struct _GLUTwindow {
324 int num; /* Small integer window id (0-based). */
325
326 /* Window system related state. */
327#if defined(_WIN32) || defined(__WIN32OS2__)
328 int pf; /* Pixel format. */
329 HDC hdc; /* Window's Win32 device context. */
330#endif
331 Window win; /* X window for GLUT window */
332 GLXContext ctx; /* OpenGL context GLUT glut window */
333 XVisualInfo *vis; /* visual for window*/
334 Bool visAlloced; /* if vis needs deallocate on destroy*/
335 Colormap cmap; /* RGB colormap for window; None if CI*/
336 GLUTcolormap *colormap; /* colormap; NULL if RGBA*/
337 GLUToverlay *overlay; /* overlay; NULL if no overlay*/
338#if defined(_WIN32) || defined(__WIN32OS2__)
339 HDC renderDc; /* Win32's device context for rendering. */
340#endif
341 Window renderWin; /* X window for rendering (might be
342 overlay) */
343 GLXContext renderCtx; /* OpenGL context for rendering (might
344 be overlay) */
345 /* GLUT settable or visible window state. */
346 int width; /* window width in pixels */
347 int height; /* window height in pixels */
348 int cursor; /* cursor name */
349 int visState; /* visibility state (-1 is unknown) */
350 int shownState; /* if window mapped */
351 int entryState; /* entry state (-1 is unknown) */
352#define GLUT_MAX_MENUS 3
353
354 int menu[GLUT_MAX_MENUS]; /* attatched menu nums */
355 /* Window relationship state. */
356 GLUTwindow *parent; /* parent window */
357 GLUTwindow *children; /* list of children */
358 GLUTwindow *siblings; /* list of siblings */
359 /* Misc. non-API visible (hidden) state. */
360 Bool treatAsSingle; /* treat this window as single-buffered
361 (it might be "fake" though) */
362 Bool forceReshape; /* force reshape before display */
363#if !defined(_WIN32) && !defined(__WIN32OS2__)
364 Bool isDirect; /* if direct context (X11 only) */
365#endif
366 Bool usedSwapBuffers; /* if swap buffers used last display */
367 long eventMask; /* mask of X events selected for */
368 int buttonUses; /* number of button uses, ref cnt */
369 int tabletPos[2]; /* tablet position (-1 is invalid) */
370 /* Work list related state. */
371 unsigned int workMask; /* mask of window work to be done */
372 GLUTwindow *prevWorkWin; /* link list of windows to work on */
373 Bool desiredMapState; /* how to mapped window if on map work
374 list */
375 Bool ignoreKeyRepeat; /* if window ignores autorepeat */
376 int desiredConfMask; /* mask of desired window configuration
377 */
378 int desiredX; /* desired X location */
379 int desiredY; /* desired Y location */
380 int desiredWidth; /* desired window width */
381 int desiredHeight; /* desired window height */
382 int desiredStack; /* desired window stack */
383 /* Per-window callbacks. */
384 GLUTdisplayCB display; /* redraw */
385 GLUTreshapeCB reshape; /* resize (width,height) */
386 GLUTmouseCB mouse; /* mouse (button,state,x,y) */
387 GLUTmotionCB motion; /* motion (x,y) */
388 GLUTpassiveCB passive; /* passive motion (x,y) */
389 GLUTentryCB entry; /* window entry/exit (state) */
390 GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
391 GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
392 GLUTwindowStatusCB windowStatus; /* window status */
393 GLUTvisibilityCB visibility; /* visibility */
394 GLUTspecialCB special; /* special key */
395 GLUTspecialCB specialUp; /* special up key */
396 GLUTbuttonBoxCB buttonBox; /* button box */
397 GLUTdialsCB dials; /* dials */
398 GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
399 GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
400 GLUTspaceButtonCB spaceButton; /* Spaceball button */
401 GLUTtabletMotionCB tabletMotion; /* tablet motion */
402 GLUTtabletButtonCB tabletButton; /* tablet button */
403#if defined(_WIN32) || defined(__WIN32OS2__)
404 GLUTjoystickCB joystick; /* joystick */
405 int joyPollInterval; /* joystick polling interval */
406#endif
407#ifdef SUPPORT_FORTRAN
408 /* Special Fortran display unneeded since no
409 parameters! */
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 visibility
418 */
419 GLUTvisibilityFCB fvisibility; /* Fortran visibility
420 */
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 */
427 GLUTspaceRotateFCB fspaceRotate; /* Spaceball rotate */
428 */
429 GLUTspaceButtonFCB fspaceButton; /* Spaceball button */
430 */
431 GLUTtabletMotionFCB ftabletMotion; /* tablet motion */
432 */
433 GLUTtabletButtonFCB ftabletButton; /* tablet button */
434 */
435#if defined(_WIN32) || defined(__WIN32OS2__)
436 GLUTjoystickFCB fjoystick; /* joystick */
437#endif
438#endif
439};
440
441struct _GLUToverlay {
442#if defined(_WIN32) || defined(__WIN32OS2__)
443 int pf;
444 HDC hdc;
445#endif
446 Window win;
447 GLXContext ctx;
448 XVisualInfo *vis; /* visual for window */
449 Bool visAlloced; /* if vis needs deallocate on destroy */
450 Colormap cmap; /* RGB colormap for window; None if CI */
451 GLUTcolormap *colormap; /* colormap; NULL if RGBA */
452 int shownState; /* if overlay window mapped */
453 Bool treatAsSingle; /* treat as single-buffered */
454#if !defined(_WIN32) && !defined(__WIN32OS2__)
455 Bool isDirect; /* if direct context */
456#endif
457 int transparentPixel; /* transparent pixel value */
458 GLUTdisplayCB display; /* redraw */
459 /* Special Fortran display unneeded since no
460 parameters! */
461};
462
463typedef struct _GLUTstale GLUTstale;
464struct _GLUTstale {
465 GLUTwindow *window;
466 Window win;
467 GLUTstale *next;
468};
469
470extern GLUTstale *__glutStaleWindowList;
471
472#define GLUT_OVERLAY_EVENT_FILTER_MASK \
473 (ExposureMask | \
474 StructureNotifyMask | \
475 EnterWindowMask | \
476 LeaveWindowMask)
477#define GLUT_DONT_PROPAGATE_FILTER_MASK \
478 (ButtonReleaseMask | \
479 ButtonPressMask | \
480 KeyPressMask | \
481 KeyReleaseMask | \
482 PointerMotionMask | \
483 Button1MotionMask | \
484 Button2MotionMask | \
485 Button3MotionMask)
486#define GLUT_HACK_STOP_PROPAGATE_MASK \
487 (KeyPressMask | \
488 KeyReleaseMask)
489
490typedef struct _GLUTmenu GLUTmenu;
491typedef struct _GLUTmenuItem GLUTmenuItem;
492struct _GLUTmenu {
493 int id; /* small integer menu id (0-based) */
494 Window win; /* X window for the menu */
495 GLUTselectCB select; /* function of menu */
496 GLUTmenuItem *list; /* list of menu entries */
497 int num; /* number of entries */
498#if !defined(_WIN32) && !defined(__WIN32OS2__)
499 Bool managed; /* are the InputOnly windows size
500 validated? */
501 Bool searched; /* help detect menu loops */
502 int pixheight; /* height of menu in pixels */
503 int pixwidth; /* width of menu in pixels */
504#endif
505 int submenus; /* number of submenu entries */
506 GLUTmenuItem *highlighted; /* pointer to highlighted menu
507 entry, NULL not highlighted */
508 GLUTmenu *cascade; /* currently cascading this menu */
509 GLUTmenuItem *anchor; /* currently anchored to this entry */
510 int x; /* current x origin relative to the
511 root window */
512 int y; /* current y origin relative to the
513 root window */
514#ifdef SUPPORT_FORTRAN
515 GLUTselectFCB fselect; /* function of menu */
516#endif
517};
518
519struct _GLUTmenuItem {
520 Window win; /* InputOnly X window for entry */
521 GLUTmenu *menu; /* menu entry belongs to */
522 Bool isTrigger; /* is a submenu trigger? */
523 int value; /* value to return for selecting this
524 entry; doubles as submenu id
525 (0-base) if submenu trigger */
526#if defined(_WIN32) || defined(__WIN32OS2__)
527 UINT unique; /* unique menu item id (Win32 only) */
528#endif
529 char *label; /* __glutStrdup'ed label string */
530 int len; /* length of label string */
531 int pixwidth; /* width of X window in pixels */
532 GLUTmenuItem *next; /* next menu entry on list for menu */
533};
534
535typedef struct _GLUTtimer GLUTtimer;
536struct _GLUTtimer {
537 GLUTtimer *next; /* list of timers */
538 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 */
543#endif
544};
545
546typedef struct _GLUTeventParser GLUTeventParser;
547struct _GLUTeventParser {
548 int (*func) (XEvent *);
549 GLUTeventParser *next;
550};
551
552/* Declarations to implement glutFullScreen support with
553 mwm/4Dwm. */
554
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. */
560typedef struct {
561#define MWM_HINTS_DECORATIONS 2
562 long flags;
563 long functions;
564 long decorations;
565 long input_mode;
566} MotifWmHints;
567
568/* Make current and buffer swap macros. */
569#if defined(_WIN32) || defined(__WIN32OS2__)
570#define MAKE_CURRENT_LAYER(window) \
571 { \
572 HGLRC currentContext = wglGetCurrentContext(); \
573 HDC currentDc = wglGetCurrentDC(); \
574 \
575 if (currentContext != window->renderCtx \
576 || currentDc != window->renderDc) { \
577 wglMakeCurrent(window->renderDc, window->renderCtx); \
578 } \
579 }
580#define MAKE_CURRENT_WINDOW(window) \
581 { \
582 HGLRC currentContext = wglGetCurrentContext(); \
583 HDC currentDc = wglGetCurrentDC(); \
584 \
585 if (currentContext != window->ctx || currentDc != window->hdc) { \
586 wglMakeCurrent(window->hdc, window->ctx); \
587 } \
588 }
589#define MAKE_CURRENT_OVERLAY(overlay) \
590 wglMakeCurrent(overlay->hdc, overlay->ctx)
591#define UNMAKE_CURRENT() \
592 wglMakeCurrent(NULL, NULL)
593#define SWAP_BUFFERS_WINDOW(window) \
594 SwapBuffers(window->hdc)
595#define SWAP_BUFFERS_LAYER(window) \
596 SwapBuffers(window->renderDc)
597#else
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)
610#endif
611
612/* private variables from glut_event.c */
613extern GLUTwindow *__glutWindowWorkList;
614extern int __glutWindowDamaged;
615#ifdef SUPPORT_FORTRAN
616extern GLUTtimer *__glutTimerList;
617extern GLUTtimer *__glutNewTimer;
618#endif
619extern GLUTmenu *__glutMappedMenu;
620
621extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
622#if !defined(_WIN32) && !defined(__WIN32OS2__)
623extern void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item,
624 int num, int type);
625extern void (*__glutFinishMenu)(Window win, int x, int y);
626extern void (*__glutPaintMenu)(GLUTmenu * menu);
627extern void (*__glutStartMenu)(GLUTmenu * menu,
628 GLUTwindow * window, int x, int y, int x_win, int y_win);
629extern GLUTmenu * (*__glutGetMenuByNum)(int menunum);
630extern GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu,
631 Window win, int *which);
632extern GLUTmenu * (*__glutGetMenu)(Window win);
633#endif
634
635/* private variables from glut_init.c */
636extern Atom __glutWMDeleteWindow;
637extern Display *__glutDisplay;
638extern unsigned int __glutDisplayMode;
639extern char *__glutDisplayString;
640extern XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle,
641 Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc);
642extern GLboolean __glutDebug;
643extern GLboolean __glutForceDirect;
644extern GLboolean __glutIconic;
645extern GLboolean __glutTryDirect;
646extern Window __glutRoot;
647extern XSizeHints __glutSizeHints;
648extern char **__glutArgv;
649extern char *__glutProgramName;
650extern int __glutArgc;
651extern int __glutConnectionFD;
652extern int __glutInitHeight;
653extern int __glutInitWidth;
654extern int __glutInitX;
655extern int __glutInitY;
656extern int __glutScreen;
657extern int __glutScreenHeight;
658extern int __glutScreenWidth;
659extern Atom __glutMotifHints;
660extern unsigned int __glutModifierMask;
661
662/* private variables from glut_menu.c */
663extern GLUTmenuItem *__glutItemSelected;
664extern GLUTmenu **__glutMenuList;
665extern void (* APIENTRY __glutMenuStatusFunc) (int, int, int);
666extern void __glutMenuModificationError(void);
667extern void __glutSetMenuItem(GLUTmenuItem * item,
668 const char *label, int value, Bool isTrigger);
669
670/* private variables from glut_win.c */
671extern GLUTwindow **__glutWindowList;
672extern GLUTwindow *__glutCurrentWindow;
673extern GLUTwindow *__glutMenuWindow;
674extern GLUTmenu *__glutCurrentMenu;
675extern int __glutWindowListSize;
676extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
677extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle,
678 Bool * visAlloced, void **fbc);
679
680/* private variables from glut_mesa.c */
681extern int __glutMesaSwapHackSupport;
682
683/* private variables from glut_gamemode.c */
684extern GLUTwindow *__glutGameModeWindow;
685
686/* private routines from glut_cindex.c */
687extern GLUTcolormap * __glutAssociateNewColormap(XVisualInfo * vis);
688extern void __glutFreeColormap(GLUTcolormap *);
689
690/* private routines from glut_cmap.c */
691extern void __glutSetupColormap(
692 XVisualInfo * vi,
693 GLUTcolormap ** colormap,
694 Colormap * cmap);
695#if !defined(_WIN32) && !defined(__WIN32OS2__)
696extern void __glutEstablishColormapsProperty(
697 GLUTwindow * window);
698extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
699#endif
700
701/* private routines from glut_cursor.c */
702extern void __glutSetCursor(GLUTwindow *window);
703
704/* private routines from glut_event.c */
705extern void __glutPutOnWorkList(GLUTwindow * window,
706 int work_mask);
707extern void __glutRegisterEventParser(GLUTeventParser * parser);
708extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
709
710/* private routines from glut_init.c */
711#if !defined(_WIN32) && !defined(__WIN32OS2__)
712extern void __glutOpenXConnection(char *display);
713#else
714extern void __glutOpenWin32Connection(char *display);
715#endif
716extern void __glutInitTime(struct timeval *beginning);
717
718/* private routines for glut_menu.c (or win32_menu.c) */
719#if defined(_WIN32) || defined(__WIN32OS2__)
720extern GLUTmenu *__glutGetMenu(Window win);
721extern GLUTmenu *__glutGetMenuByNum(int menunum);
722extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
723 Window win, int *which);
724extern void __glutStartMenu(GLUTmenu * menu,
725 GLUTwindow * window, int x, int y, int x_win, int y_win);
726extern void __glutFinishMenu(Window win, int x, int y);
727#endif
728extern void __glutSetMenu(GLUTmenu * menu);
729
730/* private routines from glut_util.c */
731extern char * __glutStrdup(const char *string);
732extern void __glutWarning(char *format,...);
733extern void __glutFatalError(char *format,...);
734extern void __glutFatalUsage(char *format,...);
735
736/* private routines from glut_win.c */
737extern GLUTwindow *__glutGetWindow(Window win);
738extern void __glutChangeWindowEventMask(long mask, Bool add);
739extern XVisualInfo *__glutDetermineVisual(
740 unsigned int mode,
741 Bool * fakeSingle,
742 XVisualInfo * (getVisualInfo) (unsigned int));
743extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
744extern void __glutSetWindow(GLUTwindow * window);
745extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
746 int callingConvention);
747extern void APIENTRY __glutDefaultReshape(int, int);
748extern GLUTwindow *__glutCreateWindow(
749 GLUTwindow * parent,
750 int x, int y, int width, int height, int gamemode);
751extern void __glutDestroyWindow(
752 GLUTwindow * window,
753 GLUTwindow * initialWindow);
754
755#if !defined(_WIN32) && !defined(__WIN32OS2__)
756/* private routines from glut_glxext.c */
757extern int __glutIsSupportedByGLX(char *);
758#endif
759
760/* private routines from glut_input.c */
761extern void __glutUpdateInputDeviceMask(GLUTwindow * window);
762
763/* private routines from glut_mesa.c */
764extern void __glutDetermineMesaSwapHackSupport(void);
765
766/* private routines from glut_gameglut.c */
767extern void __glutCloseDownGameMode(void);
768
769#if defined(_WIN32) || defined(__WIN32OS2__)
770/* private routines from win32_*.c */
771extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l);
772extern HDC XHDC;
773#endif
774
775#endif /* __glutint_h__ */
Note: See TracBrowser for help on using the repository browser.