I'm sure google would have revealed that since I know how....
it looks something like this

/* setup shader arguments for simple texture out... */
float *verts = va_arg( args, float *);
int texture = va_arg( args, int);
float *texture_verts = va_arg( args, float *);
        int alpha_level = va_arg( args, float ); /* 0-1 parameter for
shader alpha between textures */
struct private_shader_data *data = (struct private_shader_data
*)psv_userdata;

//glUniform4fv( tracker->color_attrib /* 2 */, 1, GL_FALSE, color );
//glUniform4fv( glGetUniformLocation(tracker->glProgramId, "alpha_level"),
1, GL_FALSE, alpha_level );
glEnableVertexAttribArray(0);

glVertexAttribPointer( tracker->vert_attrib /*0*/, 3, GL_FLOAT, FALSE, 0,
verts );
CheckErr();

/* texture coordinate array... need to duplicate if your textures aren't
proprotionaly the same part you're fading... .. coords would be 0.0-1.0 */
glEnableVertexAttribArray(data->texture_attrib /*1 */); CheckErr();
glVertexAttribPointer( data->texture_attrib /* 1 */, 2, GL_FLOAT, FALSE, 0,
texture_verts );
CheckErr();

glActiveTexture(GL_TEXTURE0 + 0);
CheckErr();
glBindTexture(GL_TEXTURE_2D+0, texture);
CheckErr();
glUniform1i( data->texture, 0 );
CheckErr();

  // enable texture....
glActiveTexture(GL_TEXTURE0 + 1);
CheckErr();
   // bind texture index to texture (unit?)
glBindTexture(GL_TEXTURE_2D+1, texture2);
CheckErr();
   // tell shader which texture unit to use...
glUniform1i( data->texture2, 1 );
CheckErr();



/* some earlier setup... lookup the indexes by name; after
compiling/linking...  */
data->texture = glGetUniformLocation(tracker->glProgramId, "tex");
data->texture2 = glGetUniformLocation(tracker->glProgramId, "tex2");
data->texture_attrib =  glGetAttribLocation(tracker->glProgramId,
"in_texCoord" );
data->color_attrib =  glGetAttribLocation(tracker->glProgramId, "in_color"
);


/*

static const char *gles_simple_v_shader =
   "precision mediump float;\n"
"precision mediump int;\n"
     "attribute vec4 vPosition;\n"
 "attribute vec2 in_texCoord;\n"
// I update these independantly as required... since the program stays
initialized within a context after usage it's not extremely painful
 "uniform mat4 modelView;\n"
 "uniform mat4 worldView;\n"
 "uniform mat4 Projection;\n"
 " varying vec2 out_texCoord;\n"
    "void main() {\n"
    "  gl_Position = Projection * worldView * modelView * vPosition;\n"
 "out_texCoord = in_texCoord;\n"
    "}\n";

static const char *gles_simple_p_shader =
    // "precision mediump float;\n"
   "precision mediump float;\n"
"precision mediump int;\n"
 " varying vec2 out_texCoord;\n"
 " uniform sampler2D tex;\n"
 " uniform sampler2D tex2;\n"
 " uniform float alpha_value;\n"
 "void main() {\n"
/* something like this is the actual output */
 "   gl_FragColor = texture2D( tex2, texCoord ) * alpha_value + texture2D(
tex, out_texCoord ) * ( 1-alpha_value);\n"
     "}\n" ;

*/


On Mon, Dec 29, 2014 at 5:06 AM, MobileVisuals <[email protected]>
wrote:

> I see, I will try to implement that with the mix command. So how do I
> connect the texture objects in GLSL  and OpenGL ES, representing
> the first and second texture? They are for instance textures[0] and
> textures[1] in OpenGL ES and texA and texB in Nobu Games' example.
>
> On Wednesday, December 24, 2014 1:23:22 PM UTC+1, MobileVisuals wrote:
>>
>> I want to switch from the first texture to the other one with a gradual
>> fading effect. How can I do that?
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to