From aef3f6444e6d3d3da828404f523f6a3a051046c4 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 8 Oct 2024 08:30:26 +0300 Subject: [PATCH] revert accidental commits, assert for zero-sized build_vertex_buffer(), explain the TODO on no-clear on skybox present --- src/rendering/twn_gl_15_rendering.c | 6 ++---- src/rendering/twn_gl_any_rendering.c | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index 7855414..35fe2c0 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -243,10 +243,9 @@ void use_texture_mode(TextureMode mode) { VertexBufferBuilder build_vertex_buffer(VertexBuffer buffer, size_t bytes) { + SDL_assert(bytes != 0); glBindBuffer(GL_ARRAY_BUFFER, buffer); glBufferData(GL_ARRAY_BUFFER, bytes, NULL, GL_STREAM_DRAW); - if (bytes == 0) - SDL_TriggerBreakpoint(); void *mapping = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); if (!mapping) CRY("build_vertex_buffer", "Error mapping a vertex array buffer"); @@ -282,8 +281,7 @@ void finally_render_sprites(const Primitive2D primitives[], const struct SpriteBatch batch, const VertexBuffer buffer) { - /* TODO: maybe do, dunno */ - // glBindBuffer(GL_VERTEX_ARRAY, vertex_buffer); + (void)buffer; GLsizei off; GLsizei voff; diff --git a/src/rendering/twn_gl_any_rendering.c b/src/rendering/twn_gl_any_rendering.c index b7593c9..63071f9 100644 --- a/src/rendering/twn_gl_any_rendering.c +++ b/src/rendering/twn_gl_any_rendering.c @@ -70,6 +70,9 @@ void clear_draw_buffer(void) { (1.0f / 255) * 230, (1.0f / 255) * 230, 1); + /* TODO: don't clear color when skybox is applied? */ + /* for that window should match framebuffer */ + /* also it is driver dependent, from what i can gather */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);