renderer: Add damage renderer
parent
6536cbd56f
commit
7e709c23e9
|
@ -85,3 +85,4 @@ GLuint renderer_next_tex(struct renderer* self);
|
|||
GLuint renderer_last_tex(const struct renderer* self);
|
||||
|
||||
void render(struct renderer* self);
|
||||
void render_damage(struct renderer* self);
|
||||
|
|
22
src/render.c
22
src/render.c
|
@ -409,6 +409,8 @@ void gl_draw(void)
|
|||
|
||||
void render(struct renderer* self)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, self->frame_fbo.fbo);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(self->tex_target, renderer_current_tex(self));
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
|
@ -425,6 +427,26 @@ void render(struct renderer* self)
|
|||
gl_draw();
|
||||
}
|
||||
|
||||
void render_damage(struct renderer* self)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, self->damage_fbo.fbo);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(self->tex_target, renderer_current_tex(self));
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(self->tex_target, renderer_last_tex(self));
|
||||
|
||||
glUseProgram(self->damage_shader.program);
|
||||
|
||||
glUniform1i(self->damage_shader.u_tex0, 0);
|
||||
glUniform1i(self->damage_shader.u_tex1, 1);
|
||||
|
||||
const float* proj = transforms[self->output->transform];
|
||||
glUniformMatrix2fv(self->damage_shader.u_proj, 1, GL_FALSE, proj);
|
||||
|
||||
gl_draw();
|
||||
}
|
||||
|
||||
void destroy_fbo(struct renderer_fbo* fbo)
|
||||
{
|
||||
glDeleteFramebuffers(1, &fbo->fbo);
|
||||
|
|
Loading…
Reference in New Issue