Trying selectively redraw background for an android game, but the moving image is duplicated across the screen
It's easiest if I just start by showing pictures of the problem. The pictures show a snapshot of a texture moving around.

The application on my HTC Hero:

![Image from my Hero][1]

The same application on the emulator where it works fine (Disregard the randomly placed leftovers, I know the cause of them, and it's not a problem):
![Image from the emulator][2]




Now, if you look at the first image, the top one is the "real one" and the others always follow beneath, and there are copies above aswell. I am currently only repainting the background squares that was visited, and they are for some reason drawn above the copies (you can see they are all partially painted over by a tile).

Do you have to always repaint the whole screen every frame on the android phones? Or is it possible to get rid of these weird copies?

Here is the code used to draw the textures (I'm new to opengl-es so it's a lot like replica island):

first

    public static void beginDrawing(GL10 gl, float viewWidth, float viewHeight) {
    	gl.glShadeModel(GL10.GL_FLAT);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
        gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);

        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, viewWidth, 0.0f, viewHeight, 0.0f, 1.0f);
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glPushMatrix();
        gl.glLoadIdentity();
       
        gl.glEnable(GL10.GL_TEXTURE_2D);
    }

Then for every texture (I draw background first, then in this case only one hulk texture. I'm sure it's being drawn only once):

			gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
			((GL11Ext) gl).glDrawTexfOES(x, y, 0, (float) mWidth, (float) mHeight); 

and at the end:

    public static void endDrawing(GL10 gl) {
    	gl.glDisable(GL10.GL_BLEND);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glPopMatrix();
    }



The code I use to load textures:

	private void loadGLTextures(GL10 gl) {
		int[] textures = new int[1];
		gl.glGenTextures(1, textures, 0);
		textureID = textures[0];

		gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);

		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
				GL10.GL_LINEAR);
		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
				GL10.GL_LINEAR);

		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
				GL10.GL_CLAMP_TO_EDGE);
		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
				GL10.GL_CLAMP_TO_EDGE);
		gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
				GL10.GL_MODULATE);

		GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
		int[] mCropWorkspace = new int[4];
		mCropWorkspace[0] = 0;
		mCropWorkspace[1] = bitmap.getHeight();
		mCropWorkspace[2] = bitmap.getWidth();
		mCropWorkspace[3] = -bitmap.getHeight();
		((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, 
				GL11Ext.GL_TEXTURE_CROP_RECT_OES, 
				mCropWorkspace,
				0);
		mCrop = mCropWorkspace;
		bitmap.recycle();
	}



All help is very much appriciated, and please leave a comment if anything is unclear!

  [1]: http://i.stack.imgur.com/h6dBC.png
  [2]: http://i.stack.imgur.com/wGomb.png


Trying selectively redraw background for an android game, but the moving image is duplicated across the screen
===

It's easiest if I just start by showing pictures of the problem. The pictures show a snapshot of a texture moving around.

The application on my HTC Hero:

![Image from my Hero][1]

The same application on the emulator where it works fine (Disregard the randomly placed leftovers, I know the cause of them, and it's not a problem):
![Image from the emulator][2]




Now, if you look at the first image, the top one is the "real one" and the others always follow beneath, and there are copies above aswell. I am currently only repainting the background squares that was visited, and they are for some reason drawn above the copies (you can see they are all partially painted over by a tile).

Do you have to always repaint the whole screen every frame on the android phones? Or is it possible to get rid of these weird copies?

Here is the code used to draw the textures (I'm new to opengl-es so it's a lot like replica island):

first

    public static void beginDrawing(GL10 gl, float viewWidth, float viewHeight) {
    	gl.glShadeModel(GL10.GL_FLAT);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
        gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);

        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, viewWidth, 0.0f, viewHeight, 0.0f, 1.0f);
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glPushMatrix();
        gl.glLoadIdentity();
       
        gl.glEnable(GL10.GL_TEXTURE_2D);
    }

Then for every texture (I draw background first, then in this case only one hulk texture. I'm sure it's being drawn only once):

			gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
			((GL11Ext) gl).glDrawTexfOES(x, y, 0, (float) mWidth, (float) mHeight); 

and at the end:

    public static void endDrawing(GL10 gl) {
    	gl.glDisable(GL10.GL_BLEND);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glPopMatrix();
    }



The code I use to load textures:

	private void loadGLTextures(GL10 gl) {
		int[] textures = new int[1];
		gl.glGenTextures(1, textures, 0);
		textureID = textures[0];

		gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);

		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
				GL10.GL_LINEAR);
		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
				GL10.GL_LINEAR);

		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
				GL10.GL_CLAMP_TO_EDGE);
		gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
				GL10.GL_CLAMP_TO_EDGE);
		gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
				GL10.GL_MODULATE);

		GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
		int[] mCropWorkspace = new int[4];
		mCropWorkspace[0] = 0;
		mCropWorkspace[1] = bitmap.getHeight();
		mCropWorkspace[2] = bitmap.getWidth();
		mCropWorkspace[3] = -bitmap.getHeight();
		((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, 
				GL11Ext.GL_TEXTURE_CROP_RECT_OES, 
				mCropWorkspace,
				0);
		mCrop = mCropWorkspace;
		bitmap.recycle();
	}



All help is very much appriciated, and please leave a comment if anything is unclear!

  [1]: http://i.stack.imgur.com/h6dBC.png
  [2]: http://i.stack.imgur.com/wGomb.png

