diff options
| author | onelin <oscar@nelin.dk> | 2025-11-30 00:37:10 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-12-18 21:14:17 +0000 |
| commit | c942ac022573f03496327234e494ca0981291613 (patch) | |
| tree | c3606a2888e3359578e4994c5a83b93e4acfeba3 /src/rendering.c | |
| parent | af1f93e33308a2798d18c7ab1ddaab636319b50c (diff) | |
Bind framebuffer
Diffstat (limited to 'src/rendering.c')
| -rw-r--r-- | src/rendering.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rendering.c b/src/rendering.c index 2c63c71..8a3f137 100644 --- a/src/rendering.c +++ b/src/rendering.c @@ -433,11 +433,13 @@ int renderbatch_refresh(RenderBatch* renderbatch) { * To be used inbetween draw calls */ void render_begin(Window* w) { glfwMakeContextCurrent(w->window); - ((GladGLContext*)(w->context))->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + ((GladGLContext*)w->context)->BindFramebuffer(GL_FRAMEBUFFER, 0); + ((GladGLContext*)w->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); gl->UseProgram(default_quad->shader.program); gl->BindTextureUnit(0, default_quad->texture); gl->BindVertexArray(default_quad->vao); @@ -538,6 +540,7 @@ void r_draw_model(void *restrict context, RenderTargets *restrict t, u32 framebu const GladGLContext *restrict gl = context; Camera c = *t->cam[framebuffer_idx]; + gl->BindFramebuffer(GL_FRAMEBUFFER, t->framebuffer[framebuffer_idx]); //const f32 s = pos[3]; mat4 view; // view @@ -550,6 +553,7 @@ void r_draw_model(void *restrict context, RenderTargets *restrict t, u32 framebu gl->UseProgram(o->shader.program); // ENUMERATE FRAMEBUFFER TEXTURES + gl->BindFramebuffer(GL_FRAMEBUFFER, t->framebuffer[framebuffer_idx]); gl->BindTextureUnit(0, o->texture); { |
