Clean up GL background tinting a little bit. Remove access to glRectd in favor of glRecti.

git-svn-id: https://svn.eduke32.com/eduke32@4649 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-10-25 03:25:35 +00:00
parent 62b37ddb68
commit 57cc3fe82a
6 changed files with 26 additions and 25 deletions

View file

@ -161,8 +161,8 @@ typedef void (APIENTRY * bglVertex3fvProcPtr)( const GLfloat *v );
extern bglVertex3fvProcPtr bglVertex3fv;
typedef void (APIENTRY * bglVertex3dvProcPtr)( const GLdouble *v );
extern bglVertex3dvProcPtr bglVertex3dv;
typedef void (APIENTRY * bglRectdProcPtr)( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
extern bglRectdProcPtr bglRectd;
typedef void (APIENTRY * bglRectiProcPtr)( GLint x1, GLint y1, GLint x2, GLint y2 );
extern bglRectiProcPtr bglRecti;
typedef void (APIENTRY * bglColor3fProcPtr)(GLfloat red, GLfloat green, GLfloat blue);
extern bglColor3fProcPtr bglColor3f;
typedef void (APIENTRY * bglColor4fProcPtr)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
@ -656,7 +656,7 @@ void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *src
#define bglVertex3d glVertex3d
#define bglVertex3fv glVertex3fv
#define bglVertex3dv glVertex3dv
#define bglRectd glRectd
#define bglRecti glRecti
#define bglColor3f glColor3f
#define bglColor4f glColor4f
#define bglColor4ub glColor4ub

View file

@ -220,11 +220,11 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows)
bglDisable(GL_FOG);
setpolymost2dview();
bglColor4f(0,0,0,0.67f);
bglColor4f(0.f, 0.f, 0.f, 0.67f);
bglEnable(GL_BLEND);
bglRectd(0,0, xdim,8*numrows+8);
bglColor4f(0,0,0,1);
bglRectd(0,8*numrows+4, xdim,8*numrows+8);
bglRecti(0, 0, xdim, 8*numrows+8);
bglColor3f(0.f, 0.f, 0.f);
bglRecti(0, 8*numrows+4, xdim, 8*numrows+8);
bglPopAttrib();

View file

@ -68,7 +68,7 @@ bglVertex3fProcPtr bglVertex3f;
bglVertex3dProcPtr bglVertex3d;
bglVertex3fvProcPtr bglVertex3fv;
bglVertex3dvProcPtr bglVertex3dv;
bglRectdProcPtr bglRectd;
bglRectiProcPtr bglRecti;
bglColor3fProcPtr bglColor3f;
bglColor4fProcPtr bglColor4f;
bglColor4ubProcPtr bglColor4ub;
@ -441,7 +441,7 @@ int32_t loadgldriver(const char *driver)
bglVertex3d = (bglVertex3dProcPtr) GETPROC("glVertex3d");
bglVertex3fv = (bglVertex3fvProcPtr) GETPROC("glVertex3fv");
bglVertex3dv = (bglVertex3dvProcPtr) GETPROC("glVertex3dv");
bglRectd = (bglRectdProcPtr) GETPROC("glRectd");
bglRecti = (bglRectiProcPtr) GETPROC("glRecti");
bglColor3f = (bglColor3fProcPtr) GETPROC("glColor3f");
bglColor4f = (bglColor4fProcPtr) GETPROC("glColor4f");
bglColor4ub = (bglColor4ubProcPtr) GETPROC("glColor4ub");
@ -731,7 +731,7 @@ int32_t unloadgldriver(void)
bglVertex3d = (bglVertex3dProcPtr) NULL;
bglVertex3fv = (bglVertex3fvProcPtr) NULL;
bglVertex3dv = (bglVertex3dvProcPtr) NULL;
bglRectd = (bglRectdProcPtr) NULL;
bglRecti = (bglRectiProcPtr) NULL;
bglColor3f = (bglColor3fProcPtr) NULL;
bglColor4f = (bglColor4fProcPtr) NULL;
bglColor4ub = (bglColor4ubProcPtr) NULL;

View file

@ -1468,6 +1468,8 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->name, "osdscale"))
{
osdrscale = 1.f/osdscale;
if (xdim && ydim)
OSD_ResizeDisplay(xdim, ydim);

View file

@ -32,25 +32,23 @@ int32_t osdhightile = 1;
int32_t osdshown = 0;
#ifdef __ANDROID__
float osdscale = 2.f;
float osdscale = 2.f, osdrscale = 0.5f;
#else
float osdscale = 1.f;
float osdscale = 1.f, osdrscale = 1.f;
#endif
#define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? lround(osdscale*(x)) : (x))
#define OSD_SCALEDIV(x) (int32_t)lround((x)/osdscale)
#define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? Blrintf(osdscale*(float)(x)) : (x))
#define OSD_SCALEDIV(x) (int32_t)Blrintf((float)(x) * osdrscale)
static int32_t GAME_isspace(int32_t ch)
static inline int32_t GAME_isspace(int32_t ch)
{
return (ch==32 || ch==9);
}
static int32_t GAME_getchartile(int32_t ch)
static inline int32_t GAME_getchartile(int32_t ch)
{
int32_t ac = ch-'!'+STARTALPHANUM;
if (ac < STARTALPHANUM || ac > ENDALPHANUM)
ac = -1;
return ac;
const int32_t ac = ch-'!'+STARTALPHANUM;
return (ac < STARTALPHANUM || ac > ENDALPHANUM) ? -1 : ac;
}
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
@ -143,15 +141,16 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
# ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && qsetmode==200)
{
const int32_t i8n8 = OSD_SCALE(8*numrows);
bglPushAttrib(GL_FOG_BIT);
bglDisable(GL_FOG);
setpolymost2dview();
bglColor4f(0, 0, 0, 0.67f);
bglColor4f(0.f, 0.f, 0.f, 0.67f);
bglEnable(GL_BLEND);
bglRectd(0, 0, xdim, OSD_SCALE(8*numrows+8));
bglColor4f(0, 0, 0, 1);
bglRectd(0, OSD_SCALE(8*numrows+4), xdim, OSD_SCALE(8*numrows+8));
bglRecti(0, 0, xdim, i8n8+8);
bglColor3f(0.f, 0.f, 0.f);
bglRecti(0, i8n8+4, xdim, i8n8+8);
bglPopAttrib();

View file

@ -30,7 +30,7 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows);
extern int32_t osdhightile;
extern int32_t osdshown;
extern float osdscale;
extern float osdscale, osdrscale;
#define OSDCHAR_WIDTH 8