2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-1998 Brian Paul
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * DOS/DJGPP glut driver v1.4 for Mesa
24 * Copyright (C) 2002 - Borca Daniel
25 * Email : dborca@yahoo.com
26 * Web : http://www.geocities.com/dborca
38 static int timer_installed
;
39 static volatile int ticks
;
43 static void ticks_timer (void *p
)
47 } ENDOFUNC(ticks_timer
)
51 int APIENTRY
glutGet (GLenum type
)
55 return g_curwin
->xpos
;
57 return g_curwin
->ypos
;
58 case GLUT_WINDOW_WIDTH
:
59 return g_curwin
->width
;
60 case GLUT_WINDOW_HEIGHT
:
61 return g_curwin
->height
;
62 case GLUT_WINDOW_STENCIL_SIZE
:
64 case GLUT_WINDOW_DEPTH_SIZE
:
66 case GLUT_WINDOW_RGBA
:
67 return !(g_display_mode
& GLUT_INDEX
);
68 case GLUT_WINDOW_COLORMAP_SIZE
:
69 return (g_display_mode
& GLUT_INDEX
) ? (256 - RESERVED_COLORS
) : 0;
70 case GLUT_SCREEN_WIDTH
:
72 case GLUT_SCREEN_HEIGHT
:
74 case GLUT_INIT_WINDOW_X
:
76 case GLUT_INIT_WINDOW_Y
:
78 case GLUT_INIT_WINDOW_WIDTH
:
80 case GLUT_INIT_WINDOW_HEIGHT
:
82 case GLUT_INIT_DISPLAY_MODE
:
83 return g_display_mode
;
84 case GLUT_ELAPSED_TIME
:
85 if (!timer_installed
) {
86 timer_installed
= GL_TRUE
;
88 LOCKFUNC(ticks_timer
);
89 pc_install_int(ticks_timer
, NULL
, FREQUENCY
);
91 return ticks
*1000/FREQUENCY
;
99 int APIENTRY
glutDeviceGet (GLenum type
)
102 case GLUT_HAS_KEYBOARD
:
105 return (g_mouse
!= 0);
106 case GLUT_NUM_MOUSE_BUTTONS
:
108 case GLUT_HAS_SPACEBALL
:
109 case GLUT_HAS_DIAL_AND_BUTTON_BOX
:
110 case GLUT_HAS_TABLET
:
112 case GLUT_NUM_SPACEBALL_BUTTONS
:
113 case GLUT_NUM_BUTTON_BOX_BUTTONS
:
115 case GLUT_NUM_TABLET_BUTTONS
:
124 int APIENTRY
glutGetModifiers (void)
127 int shifts
= pc_keyshifts();
129 if (shifts
& (KB_SHIFT_FLAG
| KB_CAPSLOCK_FLAG
)) {
130 mod
|= GLUT_ACTIVE_SHIFT
;
133 if (shifts
& KB_ALT_FLAG
) {
134 mod
|= GLUT_ACTIVE_ALT
;
137 if (shifts
& KB_CTRL_FLAG
) {
138 mod
|= GLUT_ACTIVE_CTRL
;