aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mgl/gl_macro.h1
-rw-r--r--src/window/window.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/mgl/gl_macro.h b/include/mgl/gl_macro.h
index 0db0a60..043d3f9 100644
--- a/include/mgl/gl_macro.h
+++ b/include/mgl/gl_macro.h
@@ -90,5 +90,6 @@
#define GL_FALSE 0
#define GL_TRUE 1
+#define GL_SCISSOR_TEST 0x0C11
#endif /* MGL_GL_MACRO_H */
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) {