From 08b27c7854cf38d3f03b0607f06c0140d6dc7952 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 14 Dec 2021 23:32:35 +0100 Subject: Enable scissor test, invert scissor coordinates --- src/window/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/window/window.c b/src/window/window.c index 64c09f2..1df12e0 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -332,6 +332,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window set_vertical_sync_enabled(self->window, 1); context->gl.glEnable(GL_TEXTURE_2D); context->gl.glEnable(GL_BLEND); + context->gl.glEnable(GL_SCISSOR_TEST); context->gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); context->gl.glEnableClientState(GL_VERTEX_ARRAY); context->gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -725,7 +726,7 @@ void mgl_window_get_view(mgl_window *self, mgl_view *view) { void mgl_window_set_scissor(mgl_window *self, mgl_scissor *new_scissor) { mgl_context *context = mgl_get_context(); self->scissor = *new_scissor; - context->gl.glScissor(self->scissor.position.x, self->scissor.position.y, self->scissor.size.x, self->scissor.size.y); + context->gl.glScissor(self->scissor.position.x, self->size.y - self->scissor.position.y - self->scissor.size.y, self->scissor.size.x, self->scissor.size.y); } void mgl_window_get_scissor(mgl_window *self, mgl_scissor *scissor) { -- cgit v1.2.3