summary refs log tree commit diff stats
path: root/src/renderer.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-12 13:48:10 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-12 13:48:10 -0400
commit1a392a79b0491c5acc766705698191ed2ed6c2e6 (patch)
tree787441b612f1aa03d777477fb32fdcb78c6a0197 /src/renderer.cpp
parentea0a959c2405511255080cae9f9558f2711a887f (diff)
downloadtherapy-1a392a79b0491c5acc766705698191ed2ed6c2e6.tar.gz
therapy-1a392a79b0491c5acc766705698191ed2ed6c2e6.tar.bz2
therapy-1a392a79b0491c5acc766705698191ed2ed6c2e6.zip
Added death to my game
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);