GL3: Fix GL3_Draw_Flash() for viewsize < 100 and odd resolutions

the flash should only be drawn in the part of the window where actual
3D rendering happens, not in the borders added if viewsize < 100
(and apparently also for with 1 pixel width if the resolution is odd).
This commit is contained in:
Daniel Gibson 2017-04-10 01:37:05 +02:00
parent 264df420e3
commit 5d3f024f82
3 changed files with 11 additions and 10 deletions

View file

@ -294,18 +294,16 @@ GL3_Draw_Fill(int x, int y, int w, int h, int c)
// now implemented in 2D mode and called after SetGL2D() because
// it's pretty similar to GL3_Draw_FadeScreen()
void
GL3_Draw_Flash(const float color[4])
GL3_Draw_Flash(const float color[4], float x, float y, float w, float h)
{
float w = vid.width;
float h = vid.height;
int i=0;
GLfloat vBuf[8] = {
// X, Y
0, h,
0, 0,
w, h,
w, 0
x, y+h,
x, y,
x+w, y+h,
x+w, y
};
glEnable(GL_BLEND);
@ -330,7 +328,7 @@ void
GL3_Draw_FadeScreen(void)
{
float color[4] = {0, 0, 0, 0.6f};
GL3_Draw_Flash(color);
GL3_Draw_Flash(color, 0, 0, vid.width, vid.height);
}
void

View file

@ -1535,7 +1535,10 @@ GL3_RenderFrame(refdef_t *fd)
if(v_blend[3] != 0.0f)
{
GL3_Draw_Flash(v_blend);
int x = (vid.width - gl3_newrefdef.width)/2;
int y = (vid.height - gl3_newrefdef.height)/2;
GL3_Draw_Flash(v_blend, x, y, gl3_newrefdef.width, gl3_newrefdef.height);
}
}

View file

@ -395,7 +395,7 @@ extern void GL3_Draw_CharScaled(int x, int y, int num, float scale);
extern void GL3_Draw_TileClear(int x, int y, int w, int h, char *pic);
extern void GL3_Draw_Fill(int x, int y, int w, int h, int c);
extern void GL3_Draw_FadeScreen(void);
extern void GL3_Draw_Flash(const float color[4]);
extern void GL3_Draw_Flash(const float color[4], float x, float y, float w, float h);
extern void GL3_Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
// gl3_image.c