Windowing effect problem

Now i am working on multi textures and trying to move one texture and keep one constant. dont know how to do? can you put some light on it.

I have done multitexturing created two gl_Position and texcoordinates for both images

and multiplied gl_Postion of one of the texture with urmatrix and which is a rotation matrix and updated the urmatrix so only texture rotates but both the textures are rotating

pls help me out with it :frowning:

Thank you

my vertex and fragment shaders are

UserData *userData = esContext->userData;
GLbyte vShaderStr[] =
"attribute vec4 a_position0;
"
"attribute vec4 a_position1;
"
"attribute vec2 a_texCoord0;
"
"varying vec2 v_texCoord0;
"
"attribute vec2 a_texCoord1;
"
"varying vec2 v_texCoord1;
"
"uniform mat4 urMatrix;
"

  "void main()                  

"
"{
"
" gl_Position = a_position0;
"
" gl_Position = a_position1*urMatrix;
"

  "   v_texCoord0 = 1.0*a_texCoord0;  

"
" v_texCoord1 = 1.0*a_texCoord1;
"
"}
";

GLbyte fShaderStr[] =
"precision mediump float;
"
"varying vec2 v_texCoord0;
"
"varying vec2 v_texCoord1;
"
"uniform sampler2D s_baseMap;
"
"uniform sampler2D s_lightMap;
"
"void main()
"
"{
"
" vec4 baseColor;
"
" vec4 lightColor;
"
"
"
" baseColor = texture2D( s_baseMap, v_texCoord0 );
"
" lightColor = texture2D( s_lightMap, v_texCoord1 );
"
" gl_FragColor = (baseColor) * (lightColor+0.25 );
"
"}

Thank you once again

i can post the code if someone can help

thank you

Found the problem. i am rotating the entire quad but i just have to rotate the texture coordinates not the position.

so its slike

mat2 rotX = mat2(cosA, sinA, -sinA, cosA);
vec4 a_pos = a_position; a_pos.xy = a_position.xy * rotZ;

http://en.wikipedia.org/wiki/Rotation_m … dimensions

I have loaded two textures on the quad. i want to rotate the upper texture. so i multiplied the upper texture coordinates with a uni mat2 as shown in the code below. How is it that i can declare and vary the angle of the 2d rotation matrix.

how is it possible that i can vary the rotMatrix so that the upper texture rotates on time image. it would be good even if a,b,c,d of mat2(a,b,c,d)*a_texCoord1 can be varied and the output rendered to screen. I am using opengl es 2.0 on windows with esUtil framework as in examples of khoronos.

Please find my shaders below

 int Init ( ESContext *esContext )
         {
       UserData *userData = esContext->userData;
        GLbyte vShaderStr[] =  
      "attribute vec4 a_position0;   
"

      "attribute vec2 a_texCoord0;   
"
      "varying vec2 v_texCoord0;     
"
      "attribute vec2 a_texCoord1;   
"
      "uniform mat2 rotMatrix ;  
" 
      "varying vec2 v_texCoord1;     
"


      "void main()                  
"
      "{                            
"
    //  "int A; 
"
      "   gl_Position = a_position0; 
"


      "   v_texCoord0 = a_texCoord0;  
"   //     ((angle*3.14)/180)


      "   v_texCoord1 = mat2 (0.7,-0.7,0.7,0.7)*a_texCoord1;  or rotMatrix*a_texCoord1;  
"    

    //  "   v_texCoord1.x = cos((angle*3.14)/180)*a_texCoord1.x-sin((angle*3.14)/180)*a_texCoord1.y;  
"
      //"   v_texCoord1.y = sin((angle*3.14)/180)*a_texCoord1.x+cos((angle*3.14)/180)*a_texCoord1.y;  
"
      "}                            
";

   GLbyte fShaderStr[] =  
      "precision mediump float;                            
"
      "varying vec2 v_texCoord0;                            
"
      "varying vec2 v_texCoord1;                            
"
      "uniform sampler2D s_baseMap;                        
"
      "uniform sampler2D s_lightMap;                       
"
      "void main()                                         
"
      "{                                                   
"
      "  vec4 baseColor;                                   
"
      "  vec4 lightColor;                                  
"
      "                                                    
"
      "  baseColor = texture2D( s_baseMap, v_texCoord0 );   
"
      "  lightColor = texture2D( s_lightMap, v_texCoord1 ); 
"
      "  gl_FragColor = (baseColor) * (lightColor+0.25 );   
"
      "}                                                   
";

Thank you

Thank you debinair

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.