diff options
| author | onelin <oscar@nelin.dk> | 2025-12-03 20:08:03 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-12-18 21:14:18 +0000 |
| commit | 841c0da02c6d042578f45ed46f443852f8aa3148 (patch) | |
| tree | 949b55979ce84d53a3282e62f9409edc0b66be75 | |
| parent | fa0e9743267397c6e3e3779479d29b63a702209f (diff) | |
Add r_clear_framebuffer
| -rw-r--r-- | src/include/daw/rendering.h | 1 | ||||
| -rw-r--r-- | src/rendering.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/include/daw/rendering.h b/src/include/daw/rendering.h index d9ad6c1..ecfb438 100644 --- a/src/include/daw/rendering.h +++ b/src/include/daw/rendering.h @@ -342,6 +342,7 @@ void r_init_renderstack( u32 *restrict buffer_params ); +void r_clear_buffer(void *restrict context, RenderTargets *restrict t, u32 framebuffer_idx); //static void r_create_renderbuffers(GladGLContext* restrict ctx, u32* restrict renderbuffer_array, u32* restrict renderbuffer_types, ivec2* restrict renderbuffer_sizes, usize num_targets); diff --git a/src/rendering.c b/src/rendering.c index fda8ded..88b1b9c 100644 --- a/src/rendering.c +++ b/src/rendering.c @@ -437,6 +437,11 @@ void render_begin(Window* w) { ((GladGLContext*)w->context)->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } +void r_clear_buffer(void *restrict context, RenderTargets *restrict t, u32 framebuffer_idx) { + ((GladGLContext*)context)->BindFramebuffer(GL_FRAMEBUFFER, t->framebuffer[framebuffer_idx]); + ((GladGLContext*)context)->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + void render_present(Window* w, RenderObject *restrict default_quad) { const GladGLContext *restrict gl = w->context; gl->BindFramebuffer(GL_FRAMEBUFFER, 0); |
