*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP glut driver v1.1 for Mesa 4.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
\r
#include "GL/glut.h"\r
+#ifndef FX\r
#include "GL/dmesa.h"\r
+#else\r
+#include "GL/fxmesa.h"\r
+#endif\r
#include "internal.h"\r
\r
\r
\r
static int window;\r
\r
+#ifndef FX\r
static DMesaVisual visual = NULL;\r
static DMesaContext context = NULL;\r
static DMesaBuffer buffer[MAX_WINDOWS];\r
+#else\r
+static void *visual = NULL;\r
+static fxMesaContext context = NULL;\r
+static int fx_attrib[32];\r
+#endif\r
\r
\r
\r
for (i=0; i<MAX_WINDOWS; i++) {\r
glutDestroyWindow(i+1);\r
}\r
+#ifndef FX\r
if (context) DMesaDestroyContext(context);\r
if (visual) DMesaDestroyVisual(visual);\r
+#else\r
+ if (context) fxMesaDestroyContext(context);\r
+#endif\r
\r
pc_close_stdout();\r
pc_close_stderr();\r
screen_h = 768;\r
}\r
\r
+#ifndef FX\r
if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP,\r
g_display_mode & GLUT_DOUBLE,\r
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0,\r
DMesaDestroyVisual(visual);\r
return 0;\r
}\r
+#else\r
+ i = 0;\r
+ if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;\r
+ if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; }\r
+ if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; }\r
+ if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; }\r
+ fx_attrib[i] = FXMESA_NONE;\r
+ if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) {\r
+ return 0;\r
+ }\r
+#endif\r
\r
pc_open_stdout();\r
pc_open_stderr();\r
pc_atexit(clean);\r
}\r
\r
+#ifndef FX\r
for (i=0; i<MAX_WINDOWS; i++) {\r
if (!buffer[i]) {\r
DMesaBuffer b;\r
}\r
\r
return 0;\r
+#else\r
+ fxMesaMakeCurrent(context);\r
+\r
+ return 1;\r
+#endif\r
}\r
\r
\r
\r
void APIENTRY glutDestroyWindow (int win)\r
{\r
+#ifndef FX\r
if (buffer[win-1]) {\r
DMesaDestroyBuffer(buffer[win-1]);\r
buffer[win-1] = NULL;\r
}\r
+#endif\r
}\r
\r
\r
void APIENTRY glutSwapBuffers (void)\r
{\r
if (g_mouse) pc_scare_mouse();\r
+#ifndef FX\r
DMesaSwapBuffers(buffer[window]);\r
+#else\r
+ fxMesaSwapBuffers();\r
+#endif\r
if (g_mouse) pc_unscare_mouse();\r
}\r
\r
\r
void APIENTRY glutPositionWindow (int x, int y)\r
{\r
+#ifndef FX\r
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) {\r
g_xpos = x;\r
g_ypos = y;\r
}\r
+#endif\r
}\r
\r
\r
void APIENTRY glutReshapeWindow (int width, int height)\r
{\r
+#ifndef FX\r
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) {\r
g_width = width;\r
g_height = height;\r
glViewport(0, 0, width, height);\r
}\r
}\r
+#endif\r
}\r
\r
\r