Source

gltut / Tut 16 Gamma and Textures / data / textureGamma.frag

Diff from to

Tut 16 Gamma and Textures/data/textureGamma.frag

-#version 150
+#version 330
+
+in vec2 colorCoord;
+
+uniform sampler2D colorTexture;
 
 out vec4 outputColor;
 
-uniform float fragLoopDuration;
-uniform float time;
-
-const vec4 firstColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);
-const vec4 secondColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
-
 void main()
 {
-	float currTime = mod(time, fragLoopDuration);
-	float currLerp = currTime / fragLoopDuration;
-	
-	outputColor = mix(firstColor, secondColor, currLerp);
+	vec4 gamma = vec4(1.0 / 2.2);
+	gamma.w = 1.0;
+	outputColor = pow(texture(colorTexture, colorCoord), gamma);
 }