Factor dup. code in SDL/Windows layers into baselayer.c:fullscreen_tint_gl().

git-svn-id: https://svn.eduke32.com/eduke32@3263 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-12-10 18:17:44 +00:00
parent 10ae7e342c
commit abb54958e1
4 changed files with 32 additions and 54 deletions

View file

@ -41,6 +41,7 @@ extern char offscreenrendering;
extern void (*baselayer_onvideomodechange)(int32_t); extern void (*baselayer_onvideomodechange)(int32_t);
#ifdef USE_OPENGL #ifdef USE_OPENGL
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm); extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm);
struct glinfo_t { struct glinfo_t {

View file

@ -127,6 +127,35 @@ void readjoybstatus(int32_t *b)
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
{
bglMatrixMode(GL_PROJECTION);
bglPushMatrix();
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglPushMatrix();
bglLoadIdentity();
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_TEXTURE_2D);
bglEnable(GL_BLEND);
bglColor4ub(r, g, b, f);
bglBegin(GL_TRIANGLES);
bglVertex2f(-2.5f, 1.f);
bglVertex2f(2.5f, 1.f);
bglVertex2f(.0f, -2.5f);
bglEnd();
bglDisable(GL_BLEND);
bglPopMatrix();
bglMatrixMode(GL_PROJECTION);
bglPopMatrix();
}
struct glinfo_t glinfo = struct glinfo_t glinfo =
{ {
"Unknown", // vendor "Unknown", // vendor

View file

@ -1728,33 +1728,7 @@ void showframe(int32_t w)
if (bpp > 8) if (bpp > 8)
{ {
if (palfadedelta) if (palfadedelta)
{ fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
bglMatrixMode(GL_PROJECTION);
bglPushMatrix();
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglPushMatrix();
bglLoadIdentity();
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_TEXTURE_2D);
bglEnable(GL_BLEND);
bglColor4ub(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
bglBegin(GL_TRIANGLES);
bglVertex2f(-2.5f, 1.f);
bglVertex2f(2.5f, 1.f);
bglVertex2f(.0f, -2.5f);
bglEnd();
bglDisable(GL_BLEND);
bglPopMatrix();
bglMatrixMode(GL_PROJECTION);
bglPopMatrix();
}
# if SDL_MAJOR_VERSION==1 # if SDL_MAJOR_VERSION==1
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();

View file

@ -1950,33 +1950,7 @@ void showframe(int32_t w)
if (bpp > 8) if (bpp > 8)
{ {
if (palfadedelta) if (palfadedelta)
{ fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
bglMatrixMode(GL_PROJECTION);
bglPushMatrix();
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglPushMatrix();
bglLoadIdentity();
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_TEXTURE_2D);
bglEnable(GL_BLEND);
bglColor4ub(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
bglBegin(GL_TRIANGLES);
bglVertex2f(-2.5f, 1.f);
bglVertex2f(2.5f, 1.f);
bglVertex2f(.0f, -2.5f);
bglEnd();
bglDisable(GL_BLEND);
bglPopMatrix();
bglMatrixMode(GL_PROJECTION);
bglPopMatrix();
}
bwglSwapBuffers(hDC); bwglSwapBuffers(hDC);
return; return;