Move scissor test reverse code to gl drivers
This commit is contained in:
parent
62bf288530
commit
f3d8b96149
@ -2706,8 +2706,14 @@ namespace video
|
||||
void COGLES2Driver::enableScissorTest(const core::rect<s32>& r)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y,
|
||||
r.getWidth(), r.getHeight());
|
||||
// The x and y is the window-space lower-left position of the scissor box,
|
||||
// and width and height define the size of the rectangle.
|
||||
s32 y = (s32)getCurrentRenderTargetSize().Height - r.LowerRightCorner.Y;
|
||||
core::rect<s32> rect_reverse(r.UpperLeftCorner.X, y,
|
||||
r.UpperLeftCorner.X + r.getWidth(),
|
||||
y + r.getHeight());
|
||||
glScissor(rect_reverse.UpperLeftCorner.X, rect_reverse.UpperLeftCorner.Y,
|
||||
rect_reverse.getWidth(), rect_reverse.getHeight());
|
||||
}
|
||||
|
||||
void COGLES2Driver::disableScissorTest()
|
||||
|
@ -4942,8 +4942,14 @@ GLenum COpenGLDriver::getZBufferBits() const
|
||||
void COpenGLDriver::enableScissorTest(const core::rect<s32>& r)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y,
|
||||
r.getWidth(), r.getHeight());
|
||||
// The x and y is the window-space lower-left position of the scissor box,
|
||||
// and width and height define the size of the rectangle.
|
||||
s32 y = (s32)getCurrentRenderTargetSize().Height - r.LowerRightCorner.Y;
|
||||
core::rect<s32> rect_reverse(r.UpperLeftCorner.X, y,
|
||||
r.UpperLeftCorner.X + r.getWidth(),
|
||||
y + r.getHeight());
|
||||
glScissor(rect_reverse.UpperLeftCorner.X, rect_reverse.UpperLeftCorner.Y,
|
||||
rect_reverse.getWidth(), rect_reverse.getHeight());
|
||||
}
|
||||
|
||||
void COpenGLDriver::disableScissorTest()
|
||||
|
@ -164,15 +164,7 @@ void FontDrawer::draw()
|
||||
}
|
||||
|
||||
if (g_clip)
|
||||
{
|
||||
const core::dimension2d<u32>& render_target_size =
|
||||
irr_driver->getActualScreenSize();
|
||||
s32 y = (s32)render_target_size.Height - g_clip->LowerRightCorner.Y;
|
||||
core::rect<s32> r(g_clip->UpperLeftCorner.X, y,
|
||||
g_clip->UpperLeftCorner.X + g_clip->getWidth(),
|
||||
y + g_clip->getHeight());
|
||||
irr_driver->getVideoDriver()->enableScissorTest(r);
|
||||
}
|
||||
irr_driver->getVideoDriver()->enableScissorTest(*g_clip);
|
||||
else
|
||||
irr_driver->getVideoDriver()->disableScissorTest();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user