Code example for GL10

Methods: glBlendFunc, glColor4x, glEnable, glLoadIdentity, glMatrixMode, glOrthof, glShadeModel, glViewport

0
	} 
 
	@Override 
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		findBestFittingRect(width, height);
		gl.glViewport(0, 0, width, height);
		gl.glMatrixMode(GL10.GL_PROJECTION);
		gl.glLoadIdentity();
		gl.glOrthof(0.0f, width, 0.0f, height, 0.0f, 1.0f);
 
		gl.glShadeModel(GL10.GL_FLAT);
		gl.glEnable(GL10.GL_BLEND);
		gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
		gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
		gl.glEnable(GL10.GL_TEXTURE_2D);
 
		final Grid backgroundGrid = mCameraPreviewSprite.getGrid();
 
		backgroundGrid.invalidateHardwareBuffers();
		mCameraPreviewSprite.width = mPreviewRect.width();
		mCameraPreviewSprite.height = mPreviewRect.height();
 
		final float v = ((float) mPreviewSize.y) / mCameraPreviewSprite.textureHeight;
		final float u = ((float) mPreviewSize.x) / mCameraPreviewSprite.textureWidth;
		backgroundGrid.set(0, 0, 0.0f, 0.0f, 0.0f, 0.0f, v, null);
		backgroundGrid.set(1, 0, mCameraPreviewSprite.width, 0.0f, 0.0f, u, v, null);
		backgroundGrid.set(0, 1, 0.0f, mCameraPreviewSprite.height, 0.0f, 0.0f, 0.0f, null);
		backgroundGrid.set(1, 1, mCameraPreviewSprite.width, mCameraPreviewSprite.height, 0.0f, u, 0.0f, null);
 
		backgroundGrid.generateHardwareBuffers(gl);
 
		mCameraPreviewSprite.y = mPreviewRect.top;
		mCameraPreviewSprite.x = mPreviewRect.left;
	}