summaryrefslogtreecommitdiff
path: root/gl.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-05 11:42:01 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-05 11:42:01 -0500
commitcefdff9a6a449506ddaeae56a2e038a1a2106846 (patch)
treee5753b372848e62528ed08b5c2d70d406914a16f /gl.c
parentf6fe651ed8bedb0308f75a7b15ef913add799848 (diff)
converted everything to modern opengl
for some reason SDL_GL_SwapWindow seems to be in a busy loop?
Diffstat (limited to 'gl.c')
-rw-r--r--gl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gl.c b/gl.c
index 738a2e8..9873bfa 100644
--- a/gl.c
+++ b/gl.c
@@ -194,6 +194,16 @@ static void gl_geometry_rect(Rect r, u32 color_rgba) {
arr_add(gl_geometry_triangles, triangle);
}
+static void gl_geometry_rect_border(Rect r, float border_thickness, u32 color) {
+ float border_radius = border_thickness * 0.5f;
+ float x1 = r.pos.x, y1 = r.pos.y, x2 = x1 + r.size.x, y2 = y1 + r.size.y;
+
+ gl_geometry_rect(rect4(x1+border_radius, y1-border_radius, x2+border_radius, y1+border_radius), color);
+ gl_geometry_rect(rect4(x1-border_radius, y2-border_radius, x2-border_radius, y2+border_radius), color);
+ gl_geometry_rect(rect4(x1-border_radius, y1-border_radius, x1+border_radius, y2-border_radius), color);
+ gl_geometry_rect(rect4(x2-border_radius, y1+border_radius, x2+border_radius, y2+border_radius), color);
+}
+
static void gl_geometry_draw(void) {
size_t ntriangles = arr_len(gl_geometry_triangles);