Added image background with adjustment sliders

- Brightness/contrast/saturation and RGBA sliders added
- Fullscreen functionality added
This commit is contained in:
James Alliban
2014-01-07 00:48:58 +00:00
parent 3053981175
commit 721d59e5f7
12 changed files with 147 additions and 11 deletions
@@ -38,3 +38,38 @@
<Name>End alpha</Name>
<Value>255.000000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Brightness</Name>
<Value>0.980263174</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Contrast</Name>
<Value>0.986842096</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Saturation</Name>
<Value>0.967105269</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Red</Name>
<Value>0.684210539</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Green</Name>
<Value>0.947368443</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Blue</Name>
<Value>0.644736826</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Alpha</Name>
<Value>1.000000000</Value>
</Widget>
@@ -1,20 +1,20 @@
<Widget>
<Kind>4</Kind>
<Name>RED</Name>
<Value>68.782897949</Value>
<Value>19.292762756</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>GREEN</Name>
<Value>67.944076538</Value>
<Value>21.809211731</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>BLUE</Name>
<Value>104.013153076</Value>
<Value>21.809211731</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>ALPHA</Name>
<Value>200.476974487</Value>
<Value>139.243423462</Value>
</Widget>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

@@ -0,0 +1,57 @@
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect baseMap;
uniform float brightness;
uniform float contrast;
uniform float saturation;
uniform float alpha;
uniform float red;
uniform float green;
uniform float blue;
uniform float shadowIntensity;
void main(void)
{
// Extract colors from baseMap
vec4 baseColor = texture2DRect( baseMap, gl_TexCoord[0].st );
vec3 baseColor3 = baseColor.rgb;
// Brightness, contrast and saturation
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
vec3 brtColor = baseColor3 * brightness;
vec3 intensity = vec3(dot(brtColor, LumCoeff));
vec3 satColor = mix(intensity, brtColor, saturation);
vec3 conColor = mix(AvgLumin, satColor, contrast);
baseColor.rgb = conColor;
// colour, alpha, lighting
//vec3 normal = normalize( v_normal );
vec3 colourVec = vec3(red, green, blue);
baseColor.rgb *= colourVec;
//float ndotl = max(dot(normal, v_light_dir), shadowIntensity);
//baseColor.rgb *= ndotl;
//baseColor.a = alpha;
vec4 result = clamp(baseColor, 0.0, 1.0);
//result.r += v_colour.r;
//result.g = 1.0;
//result += v_colour;
//result.a = v_colour.a;
gl_FragColor = result;
}
@@ -0,0 +1,8 @@
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}