hopefully fixed clown vomit issue
This commit is contained in:
parent
8931fe54d4
commit
664e33cb79
@ -85,7 +85,7 @@ renderer_init(Renderer* self, Window* window, CameraType type, const ivec2* buff
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
@ -142,6 +142,12 @@ renderer_buffer_use(Renderer* self, RendererBuffer buffer)
|
||||
fbo_bind(&self->fbos[buffer]);
|
||||
}
|
||||
|
||||
void
|
||||
renderer_buffer_clear(Renderer* self, RendererBuffer buffer)
|
||||
{
|
||||
texture_clear(&self->fboTextures[buffer]);
|
||||
}
|
||||
|
||||
void
|
||||
renderer_buffer_unbind(void)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ void renderer_free(Renderer* self);
|
||||
void renderer_update(Renderer* self);
|
||||
void renderer_present(Renderer* self);
|
||||
void renderer_buffer_unbind(void);
|
||||
void renderer_buffer_clear(Renderer* self, RendererBuffer buffer);
|
||||
|
||||
void renderer_buffer_position_from_window_position
|
||||
(
|
||||
|
@ -82,3 +82,11 @@ texture_free(Texture* self)
|
||||
glDeleteTextures(1, &self->handle);
|
||||
memset(self, '\0', sizeof(Texture));
|
||||
}
|
||||
|
||||
void
|
||||
texture_clear(Texture* self)
|
||||
{
|
||||
texture_bind(self);
|
||||
glClearTexImage(self->handle, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
texture_unbind();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ typedef struct Texture
|
||||
bool texture_from_path_init(Texture* self, const char* path);
|
||||
void texture_init(Texture* self, ivec2 size, void* data);
|
||||
void texture_surface_init(Texture* self, SDL_Surface* surface);
|
||||
void texture_clear(Texture* self);
|
||||
void texture_parameter_set(GLenum pname, GLint parameter);
|
||||
void texture_bind(Texture* self);
|
||||
void texture_unbind(void);
|
||||
|
@ -14,6 +14,8 @@ _game_quit(Game* self)
|
||||
|
||||
ecs_free(&self->ecs);
|
||||
|
||||
renderer_free(&self->renderer);
|
||||
|
||||
window_free(&self->window);
|
||||
|
||||
resources_free(&self->resources);
|
||||
@ -65,9 +67,9 @@ _game_draw(Game* self)
|
||||
renderer_clear_color_set(&self->renderer, (f32*)RENDERER_CLEAR_COLOR);
|
||||
|
||||
renderer_clear(&self->renderer);
|
||||
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_init(&self->renderer, (RendererBuffer)i);
|
||||
renderer_buffer_clear(&self->renderer, (RendererBuffer)i);
|
||||
|
||||
ecs_draw(&self->ecs);
|
||||
|
||||
@ -80,9 +82,8 @@ _game_draw(Game* self)
|
||||
(RendererBuffer)i,
|
||||
&self->postprocessing[i]
|
||||
);
|
||||
renderer_buffer_free(&self->renderer, (RendererBuffer)i);
|
||||
}
|
||||
|
||||
|
||||
renderer_present(&self->renderer);
|
||||
}
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user