I need to merge two bitmaps to use the resulting bitmap as a mask. Is there a way to do that in OpenGL-1.0 without affecting the previously drawn system.
Here is my algorithm:
1.- draw the background (opaque) 2.- draw the mask (this is a combination of two bitmaps) 3.- draw a bitmap (this need to be masked).
As a side note, I'm working with OpenGLES 1.0, so the shaders won't work. Any help would be very appreciated!
Here is my draw function:
public void onDrawFrame(GL10 gl) {
// clear the screen and depth buffer
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
// drawing
gl.glLoadIdentity();
// draw the background
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);
gl.glTranslatef(0.0f, 0.0f, -3.72f);
background.draw(gl);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glEnable(GL10.GL_BLEND);
gl.glDisable(GL10.GL_DEPTH_TEST);
// mask1 + mask2
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -3.72f);
gl.glBlendFunc(GL10.GL_DST_COLOR, GL10.GL_ZERO);
mask1.draw(gl);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, y, -3.72f);
gl.glBlendFunc(GL10.GL_DST_COLOR, GL10.GL_ZERO);
mask2.draw(gl);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -3.72f);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE);
picture.draw(gl);
gl.glDisable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glFlush();
gl.glPopMatrix();
y -= 0.2f;
}