From f87af894c1effe9816139bde15929ab3fc91c3b0 Mon Sep 17 00:00:00 2001 From: Fabian Klemp Date: Mon, 17 Nov 2014 16:15:42 +0100 Subject: [PATCH] Added alpha shading. --- Shader/phong.fsh | 4 ++-- main.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Shader/phong.fsh b/Shader/phong.fsh index fcda833..4ce9816 100644 --- a/Shader/phong.fsh +++ b/Shader/phong.fsh @@ -38,6 +38,6 @@ void main() } vec3 finalColor = specularColor + diffuseColor + ambientColor; - vec3 texture = texture(uTexture, vTexCoord).rgb; - oColor = vec4(finalColor*texture, 1.0 ); + vec4 texture = texture(uTexture, vTexCoord).rgba; + oColor = vec4(finalColor, 1.0f)*texture; } diff --git a/main.cc b/main.cc index 1d231fc..90e764d 100644 --- a/main.cc +++ b/main.cc @@ -112,6 +112,8 @@ int main( int argc, char *argv[] ) // glClearColor( 0.0, 0.0, 0.0, 1.0 ); glEnable( GL_DEPTH_TEST ); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); app.init(); int frameCount = 0;