Updates from Daniel Borca

This commit is contained in:
Brian Paul
2003-08-28 16:57:01 +00:00
parent 9e94aaf6e3
commit 760960028f
9 changed files with 71 additions and 43 deletions

View File

@@ -97,7 +97,7 @@ FAQ:
A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest
DJGPP distro, or download the separate package from my web page. Read the DJGPP distro, or download the separate package from my web page. Read the
DXE3 documentation on how to use them. DXE3 documentation on how to use them.
A) When compiling for Glide (FX=1), make sure `glid3.dxe' can be found in A) When compiling for Glide (FX=1), make sure `glide3x.dxe' can be found in
LD_LIBRARY_PATH (or top `lib' directory). LD_LIBRARY_PATH (or top `lib' directory).
2. Using Mesa for DJGPP 2. Using Mesa for DJGPP
@@ -160,19 +160,19 @@ means that `printf' can be safely called during graphics. A bit of a hack, I
know, because all messages come in bulk, but I think it's better than nothing. know, because all messages come in bulk, but I think it's better than nothing.
"Borrowed" from LIBRHUTI (Robert Hoehne). "Borrowed" from LIBRHUTI (Robert Hoehne).
Window creating defaults: 300x300x16 at (0,0), 16-bit depth, 16-bit accum, Window creating defaults: (0, 0, 300, 300), 16bpp. However, the video mode is
8-bit stencil. However, the video mode is chosen in such a way that first chosen in such a way that first window will fit. If you need high resolution
window will fit. If you need high resolution with small windows, set initial with small windows, set initial position far to the right (or way down); then
position far to the right (or way down); then you can move them back to any you can move them back to any position right before the main loop.
position right before the main loop.
The following environment variables can customize GLUT behaviour: The following environment variables can customize GLUT behaviour:
GLUT_FPS - print frames/second statistics to stderr GLUT_FPS - print frames/second statistics to stderr
DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3) DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3)
DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8) DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8)
DMESA_GLUT_DEPTH - set default depth bits DMESA_GLUT_ALPHA - set default alpha bits (8)
DMESA_GLUT_STENCIL - set default stencil bits DMESA_GLUT_DEPTH - set default depth bits (16)
DMESA_GLUT_ACCUM - set default accum bits DMESA_GLUT_STENCIL - set default stencil bits (8)
DMESA_GLUT_ACCUM - set default accum bits (16)
@@ -211,9 +211,10 @@ v1.3 (mar-2003)
v1.4 (aug-2003) v1.4 (aug-2003)
+ enabled GLUT fonts with DXE + enabled GLUT fonts with DXE
+ truly added multi-window support in GLUT + truly added multi-window support in GLUT (for Adrian Woodward)
* accomodated makefiles with the new sourcetree * accomodated makefiles with the new sourcetree
* hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii) * fixed some ALPHA issues
x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)

View File

@@ -65,7 +65,7 @@ DMesaVisual DMesaCreateVisual (GLint width, /* X res */
GLint refresh, /* refresh rate: 0=default */ GLint refresh, /* refresh rate: 0=default */
GLboolean dbFlag, /* double-buffered */ GLboolean dbFlag, /* double-buffered */
GLboolean rgbFlag, /* RGB mode */ GLboolean rgbFlag, /* RGB mode */
GLboolean alphaFlag,/* alpha buffer requested */ GLint alphaSize, /* requested bits/alpha */
GLint depthSize, /* requested bits/depth */ GLint depthSize, /* requested bits/depth */
GLint stencilSize, /* requested bits/stencil */ GLint stencilSize, /* requested bits/stencil */
GLint accumSize); /* requested bits/accum */ GLint accumSize); /* requested bits/accum */

View File

@@ -71,7 +71,7 @@ else
LDLIBS = -lglut -lglu -lgl LDLIBS = -lglut -lglu -lgl
ifeq ($(FX),1) ifeq ($(FX),1)
LDFLAGS += -L$(GLIDE)/lib LDFLAGS += -L$(GLIDE)/lib
LDLIBS += -lglid3 LDLIBS += -lgld3x
endif endif
endif endif

View File

@@ -103,6 +103,7 @@ extern GLUTidleCB g_idle_func;
extern GLUTmenuStatusCB g_menu_status_func; extern GLUTmenuStatusCB g_menu_status_func;
extern GLuint g_bpp; /* HW: bits per pixel */ extern GLuint g_bpp; /* HW: bits per pixel */
extern GLuint g_alpha; /* HW: alpha bits */
extern GLuint g_depth; /* HW: depth bits */ extern GLuint g_depth; /* HW: depth bits */
extern GLuint g_stencil; /* HW: stencil bits */ extern GLuint g_stencil; /* HW: stencil bits */
extern GLuint g_accum; /* HW: accum bits */ extern GLuint g_accum; /* HW: accum bits */

View File

@@ -35,6 +35,7 @@
#define DEFAULT_HEIGHT 300 #define DEFAULT_HEIGHT 300
#define DEFAULT_BPP 16 #define DEFAULT_BPP 16
#define ALPHA_SIZE 8
#define DEPTH_SIZE 16 #define DEPTH_SIZE 16
#define STENCIL_SIZE 8 #define STENCIL_SIZE 8
#define ACCUM_SIZE 16 #define ACCUM_SIZE 16
@@ -42,6 +43,7 @@
GLuint g_bpp = DEFAULT_BPP; GLuint g_bpp = DEFAULT_BPP;
GLuint g_alpha = ALPHA_SIZE;
GLuint g_depth = DEPTH_SIZE; GLuint g_depth = DEPTH_SIZE;
GLuint g_stencil = STENCIL_SIZE; GLuint g_stencil = STENCIL_SIZE;
GLuint g_accum = ACCUM_SIZE; GLuint g_accum = ACCUM_SIZE;
@@ -67,6 +69,9 @@ void APIENTRY glutInit (int *argc, char **argv)
if ((env = getenv("DMESA_GLUT_BPP")) != NULL) { if ((env = getenv("DMESA_GLUT_BPP")) != NULL) {
g_bpp = atoi(env); g_bpp = atoi(env);
} }
if ((env = getenv("DMESA_GLUT_ALPHA")) != NULL) {
g_alpha = atoi(env);
}
if ((env = getenv("DMESA_GLUT_DEPTH")) != NULL) { if ((env = getenv("DMESA_GLUT_DEPTH")) != NULL) {
g_depth = atoi(env); g_depth = atoi(env);
} }

View File

@@ -71,10 +71,10 @@ int APIENTRY glutCreateWindow (const char *title)
if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh, if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh,
g_display_mode & GLUT_DOUBLE, g_display_mode & GLUT_DOUBLE,
!(g_display_mode & GLUT_INDEX), !(g_display_mode & GLUT_INDEX),
g_display_mode & GLUT_ALPHA, (g_display_mode & GLUT_ALPHA ) ? g_alpha : 0,
g_display_mode & GLUT_DEPTH ? g_depth :0, (g_display_mode & GLUT_DEPTH ) ? g_depth : 0,
g_display_mode & GLUT_STENCIL ? g_stencil:0, (g_display_mode & GLUT_STENCIL) ? g_stencil : 0,
g_display_mode & GLUT_ACCUM ? g_accum :0))==NULL) { (g_display_mode & GLUT_ACCUM ) ? g_accum : 0))==NULL) {
return 0; return 0;
} }

View File

@@ -78,13 +78,13 @@ CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
ifeq ($(FX),1) ifeq ($(FX),1)
CFLAGS += -D__DOS__ -DH3 CFLAGS += -D__DOS__ -DH3
CFLAGS += -I$(GLIDE)/include -DFX CFLAGS += -I$(GLIDE)/include -DFX
LIBNAME = "MesaGL/FX DJGPP" LIBNAME = "Mesa/FX DJGPP"
else else
ifeq ($(MATROX),1) ifeq ($(MATROX),1)
CFLAGS += -DMATROX CFLAGS += -DMATROX
LIBNAME = "MesaGL/MGA DJGPP" LIBNAME = "Mesa/MGA DJGPP"
else else
LIBNAME = "MesaGL DJGPP" LIBNAME = "Mesa DJGPP"
endif endif
endif endif

View File

@@ -73,6 +73,7 @@ struct dmesa_visual {
GLvisual gl_visual; GLvisual gl_visual;
GLboolean db_flag; /* double buffered? */ GLboolean db_flag; /* double buffered? */
GLboolean rgb_flag; /* RGB mode? */ GLboolean rgb_flag; /* RGB mode? */
GLboolean sw_alpha; /* use Mesa's alpha buffer? */
GLuint depth; /* bits per pixel (1, 8, 24, etc) */ GLuint depth; /* bits per pixel (1, 8, 24, etc) */
#ifdef MATROX #ifdef MATROX
int stride_in_pixels; int stride_in_pixels;
@@ -1335,7 +1336,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
GLint refresh, GLint refresh,
GLboolean dbFlag, GLboolean dbFlag,
GLboolean rgbFlag, GLboolean rgbFlag,
GLboolean alphaFlag, GLint alphaSize,
GLint depthSize, GLint depthSize,
GLint stencilSize, GLint stencilSize,
GLint accumSize) GLint accumSize)
@@ -1343,6 +1344,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
#ifndef FX #ifndef FX
DMesaVisual v; DMesaVisual v;
GLint redBits, greenBits, blueBits, alphaBits, indexBits; GLint redBits, greenBits, blueBits, alphaBits, indexBits;
GLboolean sw_alpha;
#ifndef MATROX #ifndef MATROX
if (!dbFlag) { if (!dbFlag) {
@@ -1370,6 +1372,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
blueBits = 8; blueBits = 8;
break; break;
case 15: case 15:
alphaBits = 1;
redBits = 5; redBits = 5;
greenBits = 5; greenBits = 5;
blueBits = 5; blueBits = 5;
@@ -1391,6 +1394,23 @@ DMesaVisual DMesaCreateVisual (GLint width,
} }
} }
/* Okay,
* `alphaBits' is what we can provide
* `alphaSize' is what app requests
*
* Note that alpha buffering is required only if destination alpha is used
* in alpha blending; alpha blending modes that do not use destination alpha
* can be used w/o alpha buffer.
*
* We will use whatever ALPHA app requests. Later, in `CreateBuffer' we'll
* instruct Mesa to use its own ALPHA buffer, by passing a non-FALSE value
* for ALPHA to `_mesa_initialize_framebuffer'.
*
* Basically, 32bit modes provide ALPHA storage, but can we rely on this?
*/
alphaBits = alphaSize;
sw_alpha = (alphaBits > 0);
#ifndef MATROX #ifndef MATROX
if ((colDepth=vl_video_init(width, height, colDepth, rgbFlag, refresh)) <= 0) { if ((colDepth=vl_video_init(width, height, colDepth, rgbFlag, refresh)) <= 0) {
return NULL; return NULL;
@@ -1401,10 +1421,6 @@ DMesaVisual DMesaCreateVisual (GLint width,
} }
#endif #endif
if (alphaFlag && (alphaBits==0)) {
alphaBits = 8;
}
if ((v=(DMesaVisual)CALLOC_STRUCT(dmesa_visual)) != NULL) { if ((v=(DMesaVisual)CALLOC_STRUCT(dmesa_visual)) != NULL) {
/* Create core visual */ /* Create core visual */
_mesa_initialize_visual((GLvisual *)v, _mesa_initialize_visual((GLvisual *)v,
@@ -1421,12 +1437,13 @@ DMesaVisual DMesaCreateVisual (GLint width,
accumSize, /* accumRed */ accumSize, /* accumRed */
accumSize, /* accumGreen */ accumSize, /* accumGreen */
accumSize, /* accumBlue */ accumSize, /* accumBlue */
alphaFlag?accumSize:0, /* accumAlpha */ alphaBits?accumSize:0, /* accumAlpha */
1); /* numSamples */ 1); /* numSamples */
v->depth = colDepth; v->depth = colDepth;
v->db_flag = dbFlag; v->db_flag = dbFlag;
v->rgb_flag = rgbFlag; v->rgb_flag = rgbFlag;
v->sw_alpha = sw_alpha;
v->zbuffer = (depthSize > 0) ? 1 : 0; v->zbuffer = (depthSize > 0) ? 1 : 0;
#ifdef MATROX #ifdef MATROX
@@ -1451,7 +1468,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
if (depthSize > 0) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = depthSize; } if (depthSize > 0) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = depthSize; }
if (stencilSize > 0) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = stencilSize; } if (stencilSize > 0) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = stencilSize; }
if (accumSize > 0) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = accumSize; } if (accumSize > 0) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = accumSize; }
if (alphaFlag) { fx_attrib[i++] = FXMESA_ALPHA_SIZE; fx_attrib[i++] = 1; } if (alphaSize) { fx_attrib[i++] = FXMESA_ALPHA_SIZE; fx_attrib[i++] = alphaSize; }
fx_attrib[i++] = FXMESA_COLORDEPTH; fx_attrib[i++] = FXMESA_COLORDEPTH;
fx_attrib[i++] = colDepth; fx_attrib[i++] = colDepth;
fx_attrib[i] = FXMESA_NONE; fx_attrib[i] = FXMESA_NONE;
@@ -1493,7 +1510,7 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
visual->zbuffer == 1, visual->zbuffer == 1,
((GLvisual *)visual)->stencilBits > 0, ((GLvisual *)visual)->stencilBits > 0,
((GLvisual *)visual)->accumRedBits > 0, ((GLvisual *)visual)->accumRedBits > 0,
((GLvisual *)visual)->alphaBits > 0); visual->sw_alpha);
b->xpos = xpos; b->xpos = xpos;
b->ypos = ypos; b->ypos = ypos;
b->width = width; b->width = width;

View File

@@ -23,10 +23,10 @@
*/ */
/* /*
* DOS/DJGPP device driver v1.3 for Mesa * DOS/DJGPP device driver v1.4 for Mesa
* *
* Copyright (C) 2002 - Borca Daniel * Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com * Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca * Web : http://www.geocities.com/dborca
* *
* Thanks to CrazyPyro (Neil Funk) for FakeColor * Thanks to CrazyPyro (Neil Funk) for FakeColor
@@ -163,7 +163,11 @@ static int vl_mixfix32 (fixed r, fixed g, fixed b)
#define vl_mixrgba24 vl_mixrgb24 #define vl_mixrgba24 vl_mixrgb24
static int vl_mixrgba32 (const unsigned char rgba[]) static int vl_mixrgba32 (const unsigned char rgba[])
{ {
return (rgba[3]<<24)|(rgba[0]<<16)|(rgba[1]<<8)|(rgba[2]); /* Hack alert:
* currently, DMesa uses Mesa's alpha buffer;
* so we don't really care about alpha value here...
*/
return /*(rgba[3]<<24)|*/(rgba[0]<<16)|(rgba[1]<<8)|(rgba[2]);
} }
@@ -175,11 +179,11 @@ static int vl_mixrgba32 (const unsigned char rgba[])
* *
* Note: - * Note: -
*/ */
static int vl_mixrgb8fake (const unsigned char rgba[]) static int vl_mixrgb8fake (const unsigned char rgb[])
{ {
return array_b[rgba[2]]*G_CNT*R_CNT return array_b[rgb[2]]*G_CNT*R_CNT
+ array_g[rgba[1]]*R_CNT + array_g[rgb[1]]*R_CNT
+ array_r[rgba[0]]; + array_r[rgb[0]];
} }
#define vl_mixrgb8 vl_mixrgb8fake #define vl_mixrgb8 vl_mixrgb8fake
static int vl_mixrgb15 (const unsigned char rgb[]) static int vl_mixrgb15 (const unsigned char rgb[])
@@ -205,21 +209,21 @@ static int vl_mixrgb32 (const unsigned char rgb[])
* *
* Note: uses current read buffer * Note: uses current read buffer
*/ */
static void v_getrgba8fake6 (unsigned int offset, unsigned char rgba[]) static void v_getrgba8fake6 (unsigned int offset, unsigned char rgba[4])
{ {
word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
rgba[0] = _rgb_scale_6[(c >> 16) & 0x3F]; rgba[0] = _rgb_scale_6[(c >> 16) & 0x3F];
rgba[1] = _rgb_scale_6[(c >> 8) & 0x3F]; rgba[1] = _rgb_scale_6[(c >> 8) & 0x3F];
rgba[2] = _rgb_scale_6[c & 0x3F]; rgba[2] = _rgb_scale_6[c & 0x3F];
rgba[3] = c >> 24; /*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }
static void v_getrgba8fake8 (unsigned int offset, unsigned char rgba[]) static void v_getrgba8fake8 (unsigned int offset, unsigned char rgba[4])
{ {
word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
rgba[0] = c >> 16; rgba[0] = c >> 16;
rgba[1] = c >> 8; rgba[1] = c >> 8;
rgba[2] = c; rgba[2] = c;
rgba[3] = c >> 24; /*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }
#define v_getrgba8 v_getrgba8fake6 #define v_getrgba8 v_getrgba8fake6
static void v_getrgba15 (unsigned int offset, unsigned char rgba[4]) static void v_getrgba15 (unsigned int offset, unsigned char rgba[4])
@@ -235,7 +239,7 @@ static void v_getrgba15 (unsigned int offset, unsigned char rgba[4])
rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F]; rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F];
rgba[2] = _rgb_scale_5[c & 0x1F]; rgba[2] = _rgb_scale_5[c & 0x1F];
#endif #endif
rgba[3] = 255; /*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }
static void v_getrgba16 (unsigned int offset, unsigned char rgba[4]) static void v_getrgba16 (unsigned int offset, unsigned char rgba[4])
{ {
@@ -249,7 +253,7 @@ static void v_getrgba16 (unsigned int offset, unsigned char rgba[4])
rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F]; rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F];
rgba[2] = _rgb_scale_5[c & 0x1F]; rgba[2] = _rgb_scale_5[c & 0x1F];
#endif #endif
rgba[3] = 255; /*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }
static void v_getrgba24 (unsigned int offset, unsigned char rgba[4]) static void v_getrgba24 (unsigned int offset, unsigned char rgba[4])
{ {
@@ -257,7 +261,7 @@ static void v_getrgba24 (unsigned int offset, unsigned char rgba[4])
rgba[0] = c >> 16; rgba[0] = c >> 16;
rgba[1] = c >> 8; rgba[1] = c >> 8;
rgba[2] = c; rgba[2] = c;
rgba[3] = 255; /*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }
static void v_getrgba32 (unsigned int offset, unsigned char rgba[4]) static void v_getrgba32 (unsigned int offset, unsigned char rgba[4])
{ {
@@ -265,7 +269,7 @@ static void v_getrgba32 (unsigned int offset, unsigned char rgba[4])
rgba[0] = c >> 16; rgba[0] = c >> 16;
rgba[1] = c >> 8; rgba[1] = c >> 8;
rgba[2] = c; rgba[2] = c;
rgba[3] = c >> 24; /*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
} }