Use QFGL on 3Dfx.

This commit is contained in:
Jeff Teunissen 2000-12-08 04:36:23 +00:00
parent a356859bb2
commit ebc281c279

View file

@ -41,17 +41,6 @@
#include <glide/sst1vid.h>
#include <sys/signal.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifndef RTLD_LAZY
# ifdef DL_LAZY
# define RTLD_LAZY DL_LAZY
# else
# define RTLD_LAZY 0
# endif
#endif
#include "console.h"
#include "glquake.h"
#include "qargs.h"
@ -65,9 +54,10 @@
#define WARP_WIDTH 320
#define WARP_HEIGHT 200
static fxMesaContext fc = NULL;
// FIXME!!!!! This belongs in include/qfgl_ext.h -- deek
typedef void (GLAPIENTRY *QF_3DfxSetDitherModeEXT) (GrDitherMode_t mode);
static void *dlhand;
static fxMesaContext fc = NULL;
int VID_options_items = 0;
@ -109,8 +99,6 @@ InitSig(void)
signal(SIGTERM, signal_handler);
}
typedef void (GLAPIENTRY *gl3DfxSetDitherModeEXT_FUNC) (GrDitherMode_t mode);
/*
===============
GL_Init
@ -123,17 +111,10 @@ GL_Init (void)
Con_Printf ("Dithering: ");
dlhand = dlopen (NULL, RTLD_LAZY);
if (QFGL_ExtensionPresent ("3DFX_set_dither_mode")) {
QF_gl3DfxSetDitherModeEXT dither_select = NULL;
if (dlhand == NULL) {
Con_Printf ("unable to set.\n");
return;
}
if (strstr(gl_extensions, "3DFX_set_dither_mode")) {
gl3DfxSetDitherModeEXT_FUNC dither_select = NULL;
dither_select = (void *) dlsym(dlhand, "gl3DfxSetDitherModeEXT");
dither_select = QFGL_ExtensionAddress ("gl3DfxSetDitherModeEXT");
if (COM_CheckParm ("-dither_2x2")) {
dither_select(GR_DITHER_2x2);
@ -146,8 +127,6 @@ GL_Init (void)
Con_Printf ("disabled.\n");
}
}
dlclose(dlhand);
dlhand = NULL;
}
void
@ -229,10 +208,6 @@ findres(int *width, int *height)
return GR_RESOLUTION_640x480;
}
typedef void (GLAPIENTRY *glColorTableEXT_FUNC) (GLenum, GLenum, GLsizei,
GLenum, GLenum, const GLvoid *);
typedef void (GLAPIENTRY *gl3DfxSetPaletteEXT_FUNC) (GLuint *pal);
void
VID_Init (unsigned char *palette)
{
@ -256,23 +231,22 @@ VID_Init(unsigned char *palette)
attribs[4] = 1;
attribs[5] = FXMESA_NONE;
if ((i = COM_CheckParm("-conwidth")) != 0)
if ((i = COM_CheckParm ("-conwidth")))
vid.conwidth = atoi(com_argv[i+1]);
else
vid.conwidth = 640;
vid.conwidth &= 0xfff8; // make it a multiple of eight
if (vid.conwidth < 320)
vid.conwidth = 320;
vid.conwidth = max (vid.conwidth, 320);
// pick a conheight that matches with correct aspect
vid.conheight = vid.conwidth * 3 / 4;
if ((i = COM_CheckParm("-conheight")) != 0)
vid.conheight = atoi(com_argv[i+1]);
if (vid.conheight < 200)
vid.conheight = 200;
vid.conheight = max (vid.conheight, 200);
fc = fxMesaCreateContext (0, findres (&scr_width, &scr_height),
GR_REFRESH_75Hz, attribs);
@ -281,12 +255,8 @@ VID_Init(unsigned char *palette)
fxMesaMakeCurrent (fc);
if (vid.conheight > scr_height)
vid.conheight = scr_height;
if (vid.conwidth > scr_width)
vid.conwidth = scr_width;
vid.width = vid.conwidth;
vid.height = vid.conheight;
vid.width = vid.conwidth = min (vid.conwidth, scr_width);
vid.height = vid.conheight = min (vid.conheight, scr_height);
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 2;
@ -306,7 +276,7 @@ VID_Init(unsigned char *palette)
}
void
VID_Init_Cvars()
VID_Init_Cvars (void)
{
}