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 v0.2 for Mesa 4.0
24 * Copyright (C) 2002 - Borca Daniel
25 * Email : dborca@yahoo.com
26 * Web : http://www.geocities.com/dborca
38 static DMesaVisual visual
= NULL
;
39 static DMesaContext context
= NULL
;
40 static DMesaBuffer buffer
[MAX_WINDOWS
];
44 static void clean (void)
48 for (i
=0; i
<MAX_WINDOWS
; i
++) {
49 glutDestroyWindow(i
+1);
51 if (context
) DMesaDestroyContext(context
);
52 if (visual
) DMesaDestroyVisual(visual
);
60 int APIENTRY
glutCreateWindow (const char *title
)
65 int screen_w
= DEFAULT_WIDTH
;
66 int screen_h
= DEFAULT_HEIGHT
;
68 if ((g_width
<=640) && (g_height
<=480)) {
71 } else if ((g_width
<=800) && (g_height
<=600)) {
74 } else if ((g_width
<=1024) && (g_height
<=768)) {
79 if ((visual
=DMesaCreateVisual(screen_w
, screen_h
, DEFAULT_BPP
,
80 g_display_mode
& GLUT_DOUBLE
,
81 g_display_mode
& GLUT_DEPTH
?DEPTH_SIZE
:0,
82 g_display_mode
& GLUT_STENCIL
?STENCIL_SIZE
:0,
83 g_display_mode
& GLUT_ACCUM
?ACCUM_SIZE
:0))==NULL
) {
87 if ((context
=DMesaCreateContext(visual
, NULL
))==NULL
) {
88 DMesaDestroyVisual(visual
);
97 for (i
=0; i
<MAX_WINDOWS
; i
++) {
101 if ((b
=DMesaCreateBuffer(visual
, g_xpos
, g_ypos
, g_width
, g_height
))==NULL
) {
104 if (!DMesaMakeCurrent(context
, b
)) {
105 DMesaDestroyBuffer(b
);
109 pc_mouse_area(g_xpos
, g_ypos
, g_xpos
+ g_width
- 1, g_ypos
+ g_height
- 1);
112 buffer
[window
= i
] = b
;
121 int APIENTRY
glutCreateSubWindow (int win
, int x
, int y
, int width
, int height
)
127 void APIENTRY
glutDestroyWindow (int win
)
130 DMesaDestroyBuffer(buffer
[win
-1]);
131 buffer
[win
-1] = NULL
;
136 void APIENTRY
glutPostRedisplay (void)
138 g_redisplay
= GL_TRUE
;
142 void APIENTRY
glutSwapBuffers (void)
144 if (g_mouse
) pc_scare_mouse();
145 DMesaSwapBuffers(buffer
[window
]);
146 if (g_mouse
) pc_unscare_mouse();
150 int APIENTRY
glutGetWindow (void)
156 void APIENTRY
glutSetWindow (int win
)
162 void APIENTRY
glutSetWindowTitle (const char *title
)
167 void APIENTRY
glutSetIconTitle (const char *title
)
172 void APIENTRY
glutPositionWindow (int x
, int y
)
177 void APIENTRY
glutReshapeWindow (int width
, int height
)
182 void APIENTRY
glutPopWindow (void)
187 void APIENTRY
glutPushWindow (void)
192 void APIENTRY
glutIconifyWindow (void)
197 void APIENTRY
glutShowWindow (void)
202 void APIENTRY
glutHideWindow (void)