aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-12 21:25:01 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-12 21:25:01 +0100
commit650be43cf1409a9086d006c918f3bcce43c3ca3e (patch)
treedc29f47eebff5bedaba901ad3208af04e4b14471 /src/graphics
parented42b0aca2751fa7671b883331b4cd6d05fb7951 (diff)
Alpha blend rectangle properly for transparent windows
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/rectangle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/graphics/rectangle.c b/src/graphics/rectangle.c
index 879e0dd..de721b7 100644
--- a/src/graphics/rectangle.c
+++ b/src/graphics/rectangle.c
@@ -1,7 +1,10 @@
#include "../../include/mgl/graphics/rectangle.h"
#include "../../include/mgl/mgl.h"
+#include "../../include/mgl/window/window.h"
void mgl_rectangle_draw(mgl_context *context, const mgl_rectangle *rect) {
+ mgl_window_set_texture_blend_func(context->current_window);
+
context->gl.glColor4ub(rect->color.r, rect->color.g, rect->color.b, rect->color.a);
context->gl.glBegin(GL_QUADS);
context->gl.glVertex3f(rect->position.x, rect->position.y, 0.0f);
@@ -9,4 +12,6 @@ void mgl_rectangle_draw(mgl_context *context, const mgl_rectangle *rect) {
context->gl.glVertex3f(rect->position.x + rect->size.x, rect->position.y + rect->size.y, 0.0f);
context->gl.glVertex3f(rect->position.x, rect->position.y + rect->size.y, 0.0f);
context->gl.glEnd();
+
+ mgl_window_set_render_blend_func(context->current_window);
}