mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- fixed scissoring with out of range coordinates.
Blood's status bar sets such a bogus clipping rectangle.
This commit is contained in:
parent
e84acb7e2f
commit
6c6874cb0e
4 changed files with 7 additions and 9 deletions
|
@ -74,7 +74,7 @@ struct PolymostRenderState
|
||||||
int DepthFunc = 1;
|
int DepthFunc = 1;
|
||||||
PalEntry ClearColor = 0;
|
PalEntry ClearColor = 0;
|
||||||
short vp_x, vp_y, vp_w, vp_h;
|
short vp_x, vp_y, vp_w, vp_h;
|
||||||
short sc_x, sc_y, sc_w, sc_h;
|
short sc_x = SHRT_MIN, sc_y, sc_w, sc_h;
|
||||||
int texIds[5], samplerIds[5];
|
int texIds[5], samplerIds[5];
|
||||||
|
|
||||||
PalEntry FogColor;
|
PalEntry FogColor;
|
||||||
|
|
|
@ -444,7 +444,7 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
||||||
}
|
}
|
||||||
if (StateFlags & STF_SCISSORSET)
|
if (StateFlags & STF_SCISSORSET)
|
||||||
{
|
{
|
||||||
if (sc_x >= 0)
|
if (sc_x > SHRT_MIN)
|
||||||
{
|
{
|
||||||
glScissor(sc_x, sc_y, sc_w, sc_h);
|
glScissor(sc_x, sc_y, sc_w, sc_h);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
|
@ -397,7 +397,7 @@ public:
|
||||||
|
|
||||||
void DisableScissor()
|
void DisableScissor()
|
||||||
{
|
{
|
||||||
renderState.sc_x = -1;
|
renderState.sc_x = SHRT_MIN;
|
||||||
renderState.StateFlags |= STF_SCISSORSET;
|
renderState.StateFlags |= STF_SCISSORSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,20 +142,18 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||||
//state.SetTextureMode(cmd.mDrawMode);
|
//state.SetTextureMode(cmd.mDrawMode);
|
||||||
|
|
||||||
int sciX, sciY, sciW, sciH;
|
|
||||||
if (cmd.mFlags & F2DDrawer::DTF_Scissor)
|
if (cmd.mFlags & F2DDrawer::DTF_Scissor)
|
||||||
{
|
{
|
||||||
// scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates
|
// scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates
|
||||||
// Note that the origin here is the lower left corner!
|
// Note that the origin here is the lower left corner!
|
||||||
sciX = screen->ScreenToWindowX(cmd.mScissor[0]);
|
int sciX = screen->ScreenToWindowX(cmd.mScissor[0]);
|
||||||
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
int sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
||||||
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
int sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
||||||
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
int sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
||||||
SetScissor(sciX, sciY, sciW, sciH);
|
SetScissor(sciX, sciY, sciW, sciH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sciX = sciY = sciW = sciH = -1;
|
|
||||||
DisableScissor();
|
DisableScissor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue