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

Last change on this file since 2996 was 2996, checked in by jeroen, 25 years ago

* empty log message *

File size: 28.8 KB
Line 
1/* $Id: glutint.h,v 1.3 2000-03-04 19:10:16 jeroen Exp $ */
2#ifndef __glutint_h__
3#define __glutint_h__
4
5/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
6
7/* This program is freely distributable without licensing fees
8 and is provided without guarantee or warrantee expressed or
9 implied. This program is -not- in the public domain. */
10
11#if defined(__CYGWIN32__)
12#include <sys/time.h>
13#endif
14
15#if defined(_WIN32)
16#include "glutwin32.h"
17#else
18#if defined(__WIN32OS2__)
19#include "glutos2.h"
20#else
21#ifdef __sgi
22#define SUPPORT_FORTRAN
23#endif
24#include <X11/Xlib.h>
25#include <X11/Xutil.h>
26#include <GL/glx.h>
27#endif
28#endif
29
30#include "glut.h"
31
32/* Non-Win32 platforms need APIENTRY defined to nothing
33 because all the GLUT routines have the APIENTRY prefix
34 to make Win32 happy. */
35#ifndef APIENTRY
36#define APIENTRY
37#endif
38
39#ifdef __vms
40#if ( __VMS_VER < 70000000 )
41struct timeval {
42 __int64 val;
43};
44extern int sys$gettim(struct timeval *);
45#else
46#include <time.h>
47#endif
48#else
49#include <sys/types.h>
50#if !defined(_WIN32)
51#include <sys/time.h>
52#else
53#include <winsock.h>
54#endif
55#endif
56#if defined(__vms) && ( __VMS_VER < 70000000 )
57
58/* For VMS6.2 or lower :
59 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
60 0.0001 milliseconds. This means that there are 0.01
61 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
62 ticks/second. */
63
64#define TICKS_PER_MILLISECOND 10000
65#define TICKS_PER_SECOND 10000000
66
67#define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
68
69#define ADD_TIME(dest, src1, src2) { \
70 (dest).val = (src1).val + (src2).val; \
71}
72
73#define TIMEDELTA(dest, src1, src2) { \
74 (dest).val = (src1).val - (src2).val; \
75}
76
77#define IS_AFTER(t1, t2) ((t2).val > (t1).val)
78
79#define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
80
81#else
82#if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
83 wants 2 args. */
84#define GETTIMEOFDAY(_x) gettimeofday(_x)
85#else
86#define GETTIMEOFDAY(_x) gettimeofday(_x, (void *)NULL)
87#endif
88#define ADD_TIME(dest, src1, src2) { \
89 if(((dest).tv_usec = \
90 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
91 (dest).tv_usec -= 1000000; \
92 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
93 } else { \
94 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
95 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
96 (dest).tv_sec --;(dest).tv_usec += 1000000; \
97 } \
98 } \
99}
100#define TIMEDELTA(dest, src1, src2) { \
101 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
102 (dest).tv_usec += 1000000; \
103 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
104 } else { \
105 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
106 } \
107}
108#define IS_AFTER(t1, t2) \
109 (((t2).tv_sec > (t1).tv_sec) || \
110 (((t2).tv_sec == (t1).tv_sec) && \
111 ((t2).tv_usec > (t1).tv_usec)))
112#define IS_AT_OR_AFTER(t1, t2) \
113 (((t2).tv_sec > (t1).tv_sec) || \
114 (((t2).tv_sec == (t1).tv_sec) && \
115 ((t2).tv_usec >= (t1).tv_usec)))
116#endif
117
118#define IGNORE_IN_GAME_MODE() \
119 { if (__glutGameModeWindow) return; }
120
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)
145
146/* Frame buffer capability macros and types. */
147#define RGBA 0
148#define BUFFER_SIZE 1
149#define DOUBLEBUFFER 2
150#define STEREO 3
151#define AUX_BUFFERS 4
152#define RED_SIZE 5 /* Used as mask bit for
153 "color selected". */
154#define GREEN_SIZE 6
155#define BLUE_SIZE 7
156#define ALPHA_SIZE 8
157#define DEPTH_SIZE 9
158#define STENCIL_SIZE 10
159#define ACCUM_RED_SIZE 11 /* Used as mask bit for
160 "acc selected". */
161#define ACCUM_GREEN_SIZE 12
162#define ACCUM_BLUE_SIZE 13
163#define ACCUM_ALPHA_SIZE 14
164#define LEVEL 15
165
166#define NUM_GLXCAPS (LEVEL + 1)
167
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
172 mask bit
173 for "any
174 visual type
175 selected". */
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)
183
184#define NUM_CAPS (NUM_GLXCAPS + 11)
185
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)
192
193#define NONE 0
194#define EQ 1
195#define NEQ 2
196#define LTE 3
197#define GTE 4
198#define GT 5
199#define LT 6
200#define MIN_ 7
201
202typedef struct _Criterion {
203 int capability;
204 int comparison;
205 int value;
206} Criterion;
207
208typedef struct _FrameBufferMode {
209 XVisualInfo *vi;
210#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
211
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. */
220
221 GLXFBConfigSGIX fbc;
222#endif
223 int valid;
224 int cap[NUM_CAPS];
225} FrameBufferMode;
226
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" */
233
234#define NUM_DM_CAPS (DM_NUM+1)
235
236typedef struct _DisplayMode {
237#if defined(_WIN32)
238 DEVMODE devmode;
239#else
240#if defined(__WIN32OS2__)
241 DEVMODEA devmode;
242#else
243 /* XXX The X Window System does not have a standard
244 mechanism for display setting changes. On SGI
245 systems, GLUT could use the XSGIvc (SGI X video
246 control extension). Perhaps this can be done in
247 a future release of GLUT. */
248#endif
249#endif
250 int valid;
251 int cap[NUM_DM_CAPS];
252} DisplayMode;
253
254/* GLUT function types */
255typedef void (* GLAPIENTRY GLUTdisplayCB) (void);
256typedef void (* GLAPIENTRY GLUTreshapeCB) (int, int);
257typedef void (* GLAPIENTRY GLUTkeyboardCB) (unsigned char, int, int);
258typedef void (* GLAPIENTRY GLUTmouseCB) (int, int, int, int);
259typedef void (* GLAPIENTRY GLUTmotionCB) (int, int);
260typedef void (* GLAPIENTRY GLUTpassiveCB) (int, int);
261typedef void (* GLAPIENTRY GLUTentryCB) (int);
262typedef void (* GLAPIENTRY GLUTvisibilityCB) (int);
263typedef void (* GLAPIENTRY GLUTwindowStatusCB) (int);
264typedef void (* GLAPIENTRY GLUTidleCB) (void);
265typedef void (* GLAPIENTRY GLUTtimerCB) (int);
266typedef void (* GLAPIENTRY GLUTmenuStateCB) (int); /* DEPRICATED. */
267typedef void (* GLAPIENTRY GLUTmenuStatusCB) (int, int, int);
268typedef void (* GLAPIENTRY GLUTselectCB) (int);
269typedef void (* GLAPIENTRY GLUTspecialCB) (int, int, int);
270typedef void (* GLAPIENTRY GLUTspaceMotionCB) (int, int, int);
271typedef void (* GLAPIENTRY GLUTspaceRotateCB) (int, int, int);
272typedef void (* GLAPIENTRY GLUTspaceButtonCB) (int, int);
273typedef void (* GLAPIENTRY GLUTdialsCB) (int, int);
274typedef void (* GLAPIENTRY GLUTbuttonBoxCB) (int, int);
275typedef void (* GLAPIENTRY GLUTtabletMotionCB) (int, int);
276typedef void (* GLAPIENTRY GLUTtabletButtonCB) (int, int, int, int);
277typedef void (* GLAPIENTRY GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
278#ifdef SUPPORT_FORTRAN
279typedef void (*GLUTdisplayFCB) (void);
280typedef void (*GLUTreshapeFCB) (int *, int *);
281/* NOTE the pressed key is int, not unsigned char for Fortran! */
282typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
283typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
284typedef void (*GLUTmotionFCB) (int *, int *);
285typedef void (*GLUTpassiveFCB) (int *, int *);
286typedef void (*GLUTentryFCB) (int *);
287typedef void (*GLUTvisibilityFCB) (int *);
288typedef void (*GLUTwindowStatusFCB) (int *);
289typedef void (*GLUTidleFCB) (void);
290typedef void (*GLUTtimerFCB) (int *);
291typedef void (*GLUTmenuStateFCB) (int *); /* DEPRICATED. */
292typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
293typedef void (*GLUTselectFCB) (int *);
294typedef void (*GLUTspecialFCB) (int *, int *, int *);
295typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
296typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
297typedef void (*GLUTspaceButtonFCB) (int *, int *);
298typedef void (*GLUTdialsFCB) (int *, int *);
299typedef void (*GLUTbuttonBoxFCB) (int *, int *);
300typedef void (*GLUTtabletMotionFCB) (int *, int *);
301typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
302typedef void (*GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
303#endif
304
305typedef struct _GLUTcolorcell GLUTcolorcell;
306struct _GLUTcolorcell {
307 /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
308 GLfloat component[3];
309};
310
311typedef struct _GLUTcolormap GLUTcolormap;
312struct _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 */
320};
321
322typedef struct _GLUTwindow GLUTwindow;
323typedef struct _GLUToverlay GLUToverlay;
324struct _GLUTwindow {
325 int num; /* Small integer window id (0-based). */
326
327 /* Window system related state. */
328#if defined(_WIN32) || defined(__WIN32OS2__)
329 int pf; /* Pixel format. */
330 HDC hdc; /* Window's Win32 device context. */
331#endif
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*/
339#if defined(_WIN32) || defined(__WIN32OS2__)
340 HDC renderDc; /* Win32's device context for rendering. */
341#endif
342 Window renderWin; /* X window for rendering (might be
343 overlay) */
344 GLXContext renderCtx; /* OpenGL context for rendering (might
345 be overlay) */
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
354
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 */
364#if !defined(_WIN32) && !defined(__WIN32OS2__)
365 Bool isDirect; /* if direct context (X11 only) */
366#endif
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
375 list */
376 Bool ignoreKeyRepeat; /* if window ignores autorepeat */
377 int desiredConfMask; /* mask of desired window configuration
378 */
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 */
404#if defined(_WIN32) || defined(__WIN32OS2__)
405 GLUTjoystickCB joystick; /* joystick */
406 int joyPollInterval; /* joystick polling interval */
407#endif
408#ifdef SUPPORT_FORTRAN
409 /* Special Fortran display unneeded since no
410 parameters! */
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
419 */
420 GLUTvisibilityFCB fvisibility; /* Fortran visibility
421 */
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 */
427 */
428 GLUTspaceRotateFCB fspaceRotate; /* Spaceball rotate */
429 */
430 GLUTspaceButtonFCB fspaceButton; /* Spaceball button */
431 */
432 GLUTtabletMotionFCB ftabletMotion; /* tablet motion */
433 */
434 GLUTtabletButtonFCB ftabletButton; /* tablet button */
435 */
436#if defined(_WIN32) || defined(__WIN32OS2__)
437 GLUTjoystickFCB fjoystick; /* joystick */
438#endif
439#endif
440};
441
442struct _GLUToverlay {
443#if defined(_WIN32) || defined(__WIN32OS2__)
444 int pf;
445 HDC hdc;
446#endif
447 Window win;
448 GLXContext ctx;
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 */
455#if !defined(_WIN32) && !defined(__WIN32OS2__)
456 Bool isDirect; /* if direct context */
457#endif
458 int transparentPixel; /* transparent pixel value */
459 GLUTdisplayCB display; /* redraw */
460 /* Special Fortran display unneeded since no
461 parameters! */
462};
463
464typedef struct _GLUTstale GLUTstale;
465struct _GLUTstale {
466 GLUTwindow *window;
467 Window win;
468 GLUTstale *next;
469};
470
471extern GLUTstale *__glutStaleWindowList;
472
473#define GLUT_OVERLAY_EVENT_FILTER_MASK \
474 (ExposureMask | \
475 StructureNotifyMask | \
476 EnterWindowMask | \
477 LeaveWindowMask)
478#define GLUT_DONT_PROPAGATE_FILTER_MASK \
479 (ButtonReleaseMask | \
480 ButtonPressMask | \
481 KeyPressMask | \
482 KeyReleaseMask | \
483 PointerMotionMask | \
484 Button1MotionMask | \
485 Button2MotionMask | \
486 Button3MotionMask)
487#define GLUT_HACK_STOP_PROPAGATE_MASK \
488 (KeyPressMask | \
489 KeyReleaseMask)
490
491typedef struct _GLUTmenu GLUTmenu;
492typedef struct _GLUTmenuItem GLUTmenuItem;
493struct _GLUTmenu {
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 */
499#if !defined(_WIN32) && !defined(__WIN32OS2__)
500 Bool managed; /* are the InputOnly windows size
501 validated? */
502 Bool searched; /* help detect menu loops */
503 int pixheight; /* height of menu in pixels */
504 int pixwidth; /* width of menu in pixels */
505#endif
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
512 root window */
513 int y; /* current y origin relative to the
514 root window */
515#ifdef SUPPORT_FORTRAN
516 GLUTselectFCB fselect; /* function of menu */
517#endif
518};
519
520struct _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 */
527#if defined(_WIN32) || defined(__WIN32OS2__)
528 UINT unique; /* unique menu item id (Win32 only) */
529#endif
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 */
534};
535
536typedef struct _GLUTtimer GLUTtimer;
537struct _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 */
544#endif
545};
546
547typedef struct _GLUTeventParser GLUTeventParser;
548struct _GLUTeventParser {
549 int (*func) (XEvent *);
550 GLUTeventParser *next;
551};
552
553/* Declarations to implement glutFullScreen support with
554 mwm/4Dwm. */
555
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. */
561typedef struct {
562#define MWM_HINTS_DECORATIONS 2
563 long flags;
564 long functions;
565 long decorations;
566 long input_mode;
567} MotifWmHints;
568
569/* Make current and buffer swap macros. */
570#if defined(_WIN32) || defined(__WIN32OS2__)
571#define MAKE_CURRENT_LAYER(window) \
572 { \
573 HGLRC currentContext = wglGetCurrentContext(); \
574 HDC currentDc = wglGetCurrentDC(); \
575 \
576 if (currentContext != window->renderCtx \
577 || currentDc != window->renderDc) { \
578 wglMakeCurrent(window->renderDc, window->renderCtx); \
579 } \
580 }
581#define MAKE_CURRENT_WINDOW(window) \
582 { \
583 HGLRC currentContext = wglGetCurrentContext(); \
584 HDC currentDc = wglGetCurrentDC(); \
585 \
586 if (currentContext != window->ctx || currentDc != window->hdc) { \
587 wglMakeCurrent(window->hdc, window->ctx); \
588 } \
589 }
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)
598#else
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)
611#endif
612
613/* private variables from glut_event.c */
614extern GLUTwindow *__glutWindowWorkList;
615extern int __glutWindowDamaged;
616#ifdef SUPPORT_FORTRAN
617extern GLUTtimer *__glutTimerList;
618extern GLUTtimer *__glutNewTimer;
619#endif
620extern GLUTmenu *__glutMappedMenu;
621
622extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
623#if !defined(_WIN32) && !defined(__WIN32OS2__)
624extern void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item,
625 int num, int type);
626extern void (*__glutFinishMenu)(Window win, int x, int y);
627extern void (*__glutPaintMenu)(GLUTmenu * menu);
628extern void (*__glutStartMenu)(GLUTmenu * menu,
629 GLUTwindow * window, int x, int y, int x_win, int y_win);
630extern GLUTmenu * (*__glutGetMenuByNum)(int menunum);
631extern GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu,
632 Window win, int *which);
633extern GLUTmenu * (*__glutGetMenu)(Window win);
634#endif
635
636/* private variables from glut_init.c */
637extern Atom __glutWMDeleteWindow;
638extern Display *__glutDisplay;
639extern unsigned int __glutDisplayMode;
640extern char *__glutDisplayString;
641extern XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle,
642 Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc);
643extern GLboolean __glutDebug;
644extern GLboolean __glutForceDirect;
645extern GLboolean __glutIconic;
646extern GLboolean __glutTryDirect;
647extern Window __glutRoot;
648extern XSizeHints __glutSizeHints;
649extern char **__glutArgv;
650extern char *__glutProgramName;
651extern int __glutArgc;
652extern int __glutConnectionFD;
653extern int __glutInitHeight;
654extern int __glutInitWidth;
655extern int __glutInitX;
656extern int __glutInitY;
657extern int __glutScreen;
658extern int __glutScreenHeight;
659extern int __glutScreenWidth;
660extern Atom __glutMotifHints;
661extern unsigned int __glutModifierMask;
662
663/* private variables from glut_menu.c */
664extern GLUTmenuItem *__glutItemSelected;
665extern GLUTmenu **__glutMenuList;
666extern void (* GLAPIENTRY __glutMenuStatusFunc) (int, int, int);
667extern void __glutMenuModificationError(void);
668extern void __glutSetMenuItem(GLUTmenuItem * item,
669 const char *label, int value, Bool isTrigger);
670
671/* private variables from glut_win.c */
672extern GLUTwindow **__glutWindowList;
673extern GLUTwindow *__glutCurrentWindow;
674extern GLUTwindow *__glutMenuWindow;
675extern GLUTmenu *__glutCurrentMenu;
676extern int __glutWindowListSize;
677extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
678extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle,
679 Bool * visAlloced, void **fbc);
680
681/* private variables from glut_mesa.c */
682extern int __glutMesaSwapHackSupport;
683
684/* private variables from glut_gamemode.c */
685extern GLUTwindow *__glutGameModeWindow;
686
687/* private routines from glut_cindex.c */
688extern GLUTcolormap * __glutAssociateNewColormap(XVisualInfo * vis);
689extern void __glutFreeColormap(GLUTcolormap *);
690
691/* private routines from glut_cmap.c */
692extern void __glutSetupColormap(
693 XVisualInfo * vi,
694 GLUTcolormap ** colormap,
695 Colormap * cmap);
696#if !defined(_WIN32) && !defined(__WIN32OS2__)
697extern void __glutEstablishColormapsProperty(
698 GLUTwindow * window);
699extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
700#endif
701
702/* private routines from glut_cursor.c */
703extern void __glutSetCursor(GLUTwindow *window);
704
705/* private routines from glut_event.c */
706extern void __glutPutOnWorkList(GLUTwindow * window,
707 int work_mask);
708extern void __glutRegisterEventParser(GLUTeventParser * parser);
709extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
710
711/* private routines from glut_init.c */
712#if !defined(_WIN32) && !defined(__WIN32OS2__)
713extern void __glutOpenXConnection(char *display);
714#else
715extern void __glutOpenWin32Connection(char *display);
716#endif
717extern void __glutInitTime(struct timeval *beginning);
718
719/* private routines for glut_menu.c (or win32_menu.c) */
720#if defined(_WIN32) || defined(__WIN32OS2__)
721extern GLUTmenu *__glutGetMenu(Window win);
722extern GLUTmenu *__glutGetMenuByNum(int menunum);
723extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
724 Window win, int *which);
725extern void __glutStartMenu(GLUTmenu * menu,
726 GLUTwindow * window, int x, int y, int x_win, int y_win);
727extern void __glutFinishMenu(Window win, int x, int y);
728#endif
729extern void __glutSetMenu(GLUTmenu * menu);
730
731/* private routines from glut_util.c */
732extern char * __glutStrdup(const char *string);
733extern void __glutWarning(char *format,...);
734extern void __glutFatalError(char *format,...);
735extern void __glutFatalUsage(char *format,...);
736
737/* private routines from glut_win.c */
738extern GLUTwindow *__glutGetWindow(Window win);
739extern void __glutChangeWindowEventMask(long mask, Bool add);
740extern XVisualInfo *__glutDetermineVisual(
741 unsigned int mode,
742 Bool * fakeSingle,
743 XVisualInfo * (getVisualInfo) (unsigned int));
744extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
745extern void __glutSetWindow(GLUTwindow * window);
746extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
747 int callingConvention);
748extern void GLAPIENTRY __glutDefaultReshape(int, int);
749extern GLUTwindow *__glutCreateWindow(
750 GLUTwindow * parent,
751 int x, int y, int width, int height, int gamemode);
752extern void __glutDestroyWindow(
753 GLUTwindow * window,
754 GLUTwindow * initialWindow);
755
756#if !defined(_WIN32) && !defined(__WIN32OS2__)
757/* private routines from glut_glxext.c */
758extern int __glutIsSupportedByGLX(char *);
759#endif
760
761/* private routines from glut_input.c */
762extern void __glutUpdateInputDeviceMask(GLUTwindow * window);
763
764/* private routines from glut_mesa.c */
765extern void __glutDetermineMesaSwapHackSupport(void);
766
767/* private routines from glut_gameglut.c */
768extern void __glutCloseDownGameMode(void);
769
770#if defined(_WIN32) || defined(__WIN32OS2__)
771/* private routines from win32_*.c */
772extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l);
773extern HDC XHDC;
774#endif
775
776#endif /* __glutint_h__ */
Note: See TracBrowser for help on using the repository browser.