Skip to content

Commit

Permalink
Fix incorrect OpenGL cliprect Y position
Browse files Browse the repository at this point in the history
The documentation for `glScissor` mentions that the provided `x, y` position should represent the lower-left corner of the scissor box. Previously, it used to be set to the upper-left corner.
  • Loading branch information
Vankata453 committed Nov 25, 2023
1 parent 21dde2e commit 4f25f0a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/video/gl/gl_painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,8 @@ GLPainter::set_clip_rect(const Rect& clip_rect)
const Rect& rect = m_renderer.get_rect();
const Size& logical_size = m_renderer.get_logical_size();

const int y = rect.get_height() * clip_rect.top / logical_size.height;

glScissor(rect.left + rect.get_width() * clip_rect.left / logical_size.width,
rect.top + y,
rect.bottom - rect.get_height() * clip_rect.bottom / logical_size.height,
rect.get_width() * clip_rect.get_width() / logical_size.width,
rect.get_height() * clip_rect.get_height() / logical_size.height);
glEnable(GL_SCISSOR_TEST);
Expand Down

0 comments on commit 4f25f0a

Please sign in to comment.