Ogre 1.9 on android - bloom shader fix

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
technique
Halfling
Posts: 91
Joined: Fri Oct 22, 2010 10:46 pm

Ogre 1.9 on android - bloom shader fix

Post by technique » Fri Nov 29, 2013 10:08 pm

I got a few compiler errors in the logfile trying to use bloom on android.
[...]
11-29 21:14:31.478: I/OGRE(10350): Vertex Program:Ogre/Compositor/StdQuad_Tex2a_GLSLES_vp Fragment Program:BrightBloom2_ps20_glsles
11-29 21:14:31.478: I/OGRE(10350): GLSL link result :
11-29 21:14:31.478: I/OGRE(10350): L0008 Varying 'uv0' not found in vertex shader
11-29 21:14:31.478: I/OGRE(10350): Vertex Program:Ogre/Compositor/StdQuad_Tex2a_GLSLES_vp Fragment Program:BrightBloom2_ps20_glsles
11-29 21:14:31.478: I/OGRE(10350): GLSL validation result :
11-29 21:14:31.478: I/OGRE(10350): L0008 Varying 'uv0' not found in vertex shader
11-29 21:14:31.478: I/OGRE(10350): Validate: Program is not successfully linked
[...]
Its the standard compositor script from the examples and alle standard programs as well.

Just change uv0 to oUv0 in BrightBloom2_ps20.glsles. This is because the Ogre/Compositor/StdQuad_Tex2a_vp vertex-shader is used for linking and the varying was renamed in this shader.

Code: Select all

#version 100
precision mediump int;
precision mediump float;

//-------------------------------
//BrightBloom_ps20.glsles
// High-pass filter for obtaining luminance
// We use an approximation formula that is pretty fast:
//   f(x) = ( -3 * ( x - 1 )^2 + 1 ) * 2
//   Color += Grayscale( f(Color) ) + 0.6
//
// Special thanks to ATI for their great HLSL2GLSL utility
//     http://sourceforge.net/projects/hlsl2glsl
//-------------------------------

uniform sampler2D RT;
varying vec2 oUv0;

void main()
{
    vec4 tex;
    vec4 bright4;
    float bright;

    tex = texture2D(RT, oUv0);
    tex -= 1.00000;
    bright4 = -6.00000 * tex * tex + 2.00000;
    bright = dot( bright4, vec4( 0.333333, 0.333333, 0.333333, 0.000000) );
    tex += (bright + 0.600000);

    gl_FragColor = tex;
}

After this - the bloom compositor is working as expected!
0 x
Image
Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.

Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free

Full-Version:
http://play.google.com/store/apps/detai ... msdefender

Post Reply