revert accidental commits, assert for zero-sized build_vertex_buffer(), explain the TODO on no-clear on skybox present

This commit is contained in:
veclav talica 2024-10-08 08:30:26 +03:00
parent 60716c6d7b
commit aef3f6444e
2 changed files with 5 additions and 4 deletions

View File

@ -243,10 +243,9 @@ void use_texture_mode(TextureMode mode) {
VertexBufferBuilder build_vertex_buffer(VertexBuffer buffer, size_t bytes) { VertexBufferBuilder build_vertex_buffer(VertexBuffer buffer, size_t bytes) {
SDL_assert(bytes != 0);
glBindBuffer(GL_ARRAY_BUFFER, buffer); glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, bytes, NULL, GL_STREAM_DRAW); glBufferData(GL_ARRAY_BUFFER, bytes, NULL, GL_STREAM_DRAW);
if (bytes == 0)
SDL_TriggerBreakpoint();
void *mapping = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); void *mapping = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
if (!mapping) if (!mapping)
CRY("build_vertex_buffer", "Error mapping a vertex array buffer"); 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 struct SpriteBatch batch,
const VertexBuffer buffer) const VertexBuffer buffer)
{ {
/* TODO: maybe do, dunno */ (void)buffer;
// glBindBuffer(GL_VERTEX_ARRAY, vertex_buffer);
GLsizei off; GLsizei off;
GLsizei voff; GLsizei voff;

View File

@ -70,6 +70,9 @@ void clear_draw_buffer(void) {
(1.0f / 255) * 230, (1.0f / 255) * 230,
(1.0f / 255) * 230, 1); (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 | glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT); GL_STENCIL_BUFFER_BIT);