From daaa3ef68705da389d39ef625840bf5278b25f22 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sun, 25 Feb 2024 16:01:39 -0800 Subject: Add gfx_reset_polygon_offset(). --- gfx/include/gfx/render_backend.h | 3 +++ gfx/src/render/render_backend.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/gfx/include/gfx/render_backend.h b/gfx/include/gfx/render_backend.h index 722ea5e..8d3c42b 100644 --- a/gfx/include/gfx/render_backend.h +++ b/gfx/include/gfx/render_backend.h @@ -338,6 +338,9 @@ void gfx_set_culling(RenderBackend*, bool enable); /// Set polygon offset. void gfx_set_polygon_offset(RenderBackend*, float scale, float bias); +/// Reset the polygon offset. +void gfx_reset_polygon_offset(RenderBackend*); + // ----------------------------------------------------------------------------- // Buffers. // ----------------------------------------------------------------------------- diff --git a/gfx/src/render/render_backend.c b/gfx/src/render/render_backend.c index 4e783f8..8e88feb 100644 --- a/gfx/src/render/render_backend.c +++ b/gfx/src/render/render_backend.c @@ -130,6 +130,12 @@ void gfx_set_polygon_offset( glPolygonOffset(scale, bias); } +void gfx_reset_polygon_offset(RenderBackend* render_backend) { + assert(render_backend); + glPolygonOffset(0, 0); + glDisable(GL_POLYGON_OFFSET_FILL); +} + // ----------------------------------------------------------------------------- // Buffers. // ----------------------------------------------------------------------------- -- cgit v1.2.3