summary refs log tree commit diff stats
path: root/src/renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r--src/renderer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index f01d72a..64c9fd0 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp
@@ -613,7 +613,7 @@ void Texture::fill(Rectangle dstrect, int r, int g, int b)
613 glDeleteBuffers(1, &vertexbuffer); 613 glDeleteBuffers(1, &vertexbuffer);
614} 614}
615 615
616void Texture::blit(const Texture& srctex, Rectangle srcrect, Rectangle dstrect) 616void Texture::blit(const Texture& srctex, Rectangle srcrect, Rectangle dstrect, double alpha)
617{ 617{
618 if (!rendererInitialized) 618 if (!rendererInitialized)
619 { 619 {
@@ -621,6 +621,8 @@ void Texture::blit(const Texture& srctex, Rectangle srcrect, Rectangle dstrect)
621 exit(-1); 621 exit(-1);
622 } 622 }
623 623
624 alpha = glm::clamp(alpha, 0.0, 1.0);
625
624 // Target the framebuffer 626 // Target the framebuffer
625 glBindFramebuffer(GL_FRAMEBUFFER, generic_framebuffer); 627 glBindFramebuffer(GL_FRAMEBUFFER, generic_framebuffer);
626 glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texID, 0); 628 glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texID, 0);
@@ -670,6 +672,7 @@ void Texture::blit(const Texture& srctex, Rectangle srcrect, Rectangle dstrect)
670 glActiveTexture(GL_TEXTURE0); 672 glActiveTexture(GL_TEXTURE0);
671 glBindTexture(GL_TEXTURE_2D, srctex.texID); 673 glBindTexture(GL_TEXTURE_2D, srctex.texID);
672 glUniform1i(glGetUniformLocation(blitShader, "srctex"), 0); 674 glUniform1i(glGetUniformLocation(blitShader, "srctex"), 0);
675 glUniform1f(glGetUniformLocation(blitShader, "alpha"), alpha);
673 676
674 // Blit! 677 // Blit!
675 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 678 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);