How to do multi-texturing using open gl es 1.1 in Android

583 Views Asked by At

What I have done

Currently in my Android app I am drawing rectangles with two different textures
There is a fade in (changes the alpha ) animation for one texture (for the second one ) is given.

What I Want.

I want to use multi - texturing thus draw both texture in a single rectangle. But I am not able to find any helping stuffs that using opengl es 1.1 for multi texturing with android.

Please any one help me to do multi texturing

Here is my code

    firstGanColorVert.position(0);
    gl.glColorPointer(4, GL10.GL_FLOAT, VERTEX_SIZE, firstGanColorVert);        
    gl.glBindTexture(GL10.GL_TEXTURE_2D, firstGaneshaTexture);          


    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();            
    gl.glTranslatef(this.x,this.y ,0);  

    textCordPointer(gl);        
    gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices);   


    fadeAnimation();

    secondGanColorVert.position(0);
    gl.glColorPointer(4, GL10.GL_FLOAT, VERTEX_SIZE, secondGanColorVert);
    gl.glBindTexture(GL10.GL_TEXTURE_2D, secondGaneshaTexture);         


    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();            
    gl.glTranslatef(this.x,this.y ,0);          
    textCordPointer(gl);        
    gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices);
1

There are 1 best solutions below

0
On

I'm not sure how much help this will be, but the Imagination Technologies' SDK includes source for quite a number example programs for OpenGL ES. If you download that (free registeration required) in the "SDK3.0/Examples/Intermediate" subdirectory there is a multitexture example. (I only opted for the "Windows emulation" option but android was also listed). Might be worth looking at.