Results 1 to 4 of 4

Thread: Shader gives different results on different android phones!

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2

    Shader gives different results on different android phones!

    I am trying to implement a blur filter with opengl es 2.0 on android.
    Here is the code i am using.
    Code :
    varying highp vec2 fragTexCoord;
    highp vec2 u_Scale;
    uniform sampler2D s_texture;
    highp vec2 gaussFilter[7];
    uniform highp float radius;
     
    highp vec4 boxVerBlur(){
    	gaussFilter[0] = vec2( -3.0,0.015625);
    	gaussFilter[1] = vec2(-2.0,	0.09375);
    	gaussFilter[2] = vec2(-1.0,	0.234375);
    	gaussFilter[3] = vec2(0.0,	0.3125);
    	gaussFilter[4] = vec2(1.0,	0.234375);
    	gaussFilter[5] = vec2(2.0,	0.09375);
    	gaussFilter[6] = vec2(3.0,	0.015625);
     
        highp	vec4  color = vec4(0,0,0,1);
        u_Scale = vec2( 1.0/radius, 0 );
        for( int i = 0; i < 7; i++ )
        {
        	color += texture2D( s_texture, vec2( fragTexCoord.x + gaussFilter[i].x*u_Scale.x, fragTexCoord.y + gaussFilter[i].x*u_Scale.y )) * gaussFilter[i].y;
        }
        return color;
    }
     
    void main(void)
    {
    	gl_FragColor = boxVerBlur();
    }

    On "Samsung Galaxy S" it works as expected. However when i run same app on "Samsung Galaxy Ace," it results a brighter texture without blur effect.

    Result from Galaxy S




    Result from Galaxy Ace

  2. #2
    Junior Member
    Join Date
    Sep 2011
    Posts
    2

    Re: Shader gives different results on different android phon

    If i need to paraphrase the question, which part of the code above is hardware dependent ?

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Location
    Los Angeles
    Posts
    1

    Re: Shader gives different results on different android phon

    Quote Originally Posted by dirhem
    I am trying to implement a blur filter with opengl es 2.0 on android.
    Here is the code i am using.
    Code :
    varying highp vec2 fragTexCoord;
    highp vec2 u_Scale;
    uniform sampler2D s_texture;
    highp vec2 gaussFilter[7];
    uniform highp float radius;
     
    highp vec4 boxVerBlur(){
    	gaussFilter[0] = vec2( -3.0,0.015625);
    	gaussFilter[1] = vec2(-2.0,	0.09375);
    	gaussFilter[2] = vec2(-1.0,	0.234375);
    	gaussFilter[3] = vec2(0.0,	0.3125);
    	gaussFilter[4] = vec2(1.0,	0.234375);
    	gaussFilter[5] = vec2(2.0,	0.09375);
    	gaussFilter[6] = vec2(3.0,	0.015625);
     
        highp	vec4  color = vec4(0,0,0,1);
        u_Scale = vec2( 1.0/radius, 0 );
        for( int i = 0; i < 7; i++ )
        {
        	color += texture2D( s_texture, vec2( fragTexCoord.x + gaussFilter[i].x*u_Scale.x, fragTexCoord.y + gaussFilter[i].x*u_Scale.y )) * gaussFilter[i].y;
        }
        return color;
    }
     
    void main(void)
    {
    	gl_FragColor = boxVerBlur();
    }

    On "Samsung Galaxy S" it works as expected. However when i run same app on "Samsung Galaxy Ace," it results a brighter texture without blur effect.

    Result from Galaxy S




    Result from Galaxy Ace
    I am having the same issue with the resolution on my Samsung phone as well. Does anyone has a clue on what is going on and how can I remedy this situation? Do I have to update the software or what?

  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    1

    Re: Shader gives different results on different android phon

    Quote Originally Posted by elizabethpollard
    Quote Originally Posted by dirhem
    I am trying to implement a blur filter with opengl es 2.0 on android.
    Here is the code i am using.
    Code :
    varying highp vec2 fragTexCoord;
    highp vec2 u_Scale;
    uniform sampler2D s_texture;
    highp vec2 gaussFilter[7];
    uniform highp float radius;
     
    highp vec4 boxVerBlur(){
    	gaussFilter[0] = vec2( -3.0,0.015625);
    	gaussFilter[1] = vec2(-2.0,	0.09375);
    	gaussFilter[2] = vec2(-1.0,	0.234375);
    	gaussFilter[3] = vec2(0.0,	0.3125);
    	gaussFilter[4] = vec2(1.0,	0.234375);
    	gaussFilter[5] = vec2(2.0,	0.09375);
    	gaussFilter[6] = vec2(3.0,	0.015625);
     
        highp	vec4  color = vec4(0,0,0,1);
        u_Scale = vec2( 1.0/radius, 0 );
        for( int i = 0; i < 7; i++ )
        {
        	color += texture2D( s_texture, vec2( fragTexCoord.x + gaussFilter[i].x*u_Scale.x, fragTexCoord.y + gaussFilter[i].x*u_Scale.y )) * gaussFilter[i].y;
        }
        return color;
    }
     
    void main(void)
    {
    	gl_FragColor = boxVerBlur();
    }

    On "Samsung Galaxy S" it works as expected. However when i run same app on "Samsung Galaxy Ace," it results a brighter texture without blur effect.

    Result from Galaxy S




    Result from Galaxy Ace
    I am having the same issue with the resolution on my Samsung phone as well. Does anyone has a clue on what is going on and how can I remedy this situation? Do I have to update the software or what?

Similar Threads

  1. Android SDK // Eclipse // OPENGL ES 2.0 -> Shader Question
    By DerTherion in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 2
    Last Post: 09-10-2011, 09:03 PM
  2. 3d graphics on nokia 3g phones
    By lawrencesuniga in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 09-09-2005, 10:17 AM
  3. 3D hardware acceleration on phones ?
    By bernot_v in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 10-27-2004, 04:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •