Code example for GL10

Methods: glOrthof, glRotatef, glTranslatef

0
	} 
 
	public void onApplyMatrix(final GL10 pGL) {
		GLHelper.setProjectionIdentityMatrix(pGL);
 
		pGL.glOrthof(this.getMinX(), this.getMaxX(), this.getMaxY(), this.getMinY(), this.mNearZ, this.mFarZ);
		//Log.v("Camera", String.format("glOrtho Min: %f,%f Max: %f,%f", this.getMinX(), this.getMinY(), this.getMaxX(), this.getMaxY())); 
 
		final float rotation = this.mRotation;
		if(rotation != 0) {
			this.applyRotation(pGL, this.getCenterX(), this.getCenterY(), rotation);
		} 
	} 
 
	public void onApplyPositionIndependentMatrix(final GL10 pGL) {
		GLHelper.setProjectionIdentityMatrix(pGL);
 
		final float width = this.mMaxX - this.mMinX;
		final float height = this.mMaxY - this.mMinY;
 
		pGL.glOrthof(0, width, height, 0, this.mNearZ, this.mFarZ);
 
		final float rotation = this.mRotation;
		if(rotation != 0) {
			this.applyRotation(pGL, width * 0.5f, height * 0.5f, rotation);
		} 
	} 
 
	public void onApplyCameraSceneMatrix(final GL10 pGL) {
		GLHelper.setProjectionIdentityMatrix(pGL);
 
		final float width = this.mMaxX - this.mMinX;
		final float height = this.mMaxY - this.mMinY;
 
		pGL.glOrthof(0, width, height, 0, this.mNearZ, this.mFarZ);
 
		final float cameraSceneRotation = this.mCameraSceneRotation;
		if(cameraSceneRotation != 0) {
			this.applyRotation(pGL, width * 0.5f, height * 0.5f, cameraSceneRotation);
		} 
	} 
 
	private void applyRotation(final GL10 pGL, final float pRotationCenterX, final float pRotationCenterY, final float pAngle) {
		pGL.glTranslatef(pRotationCenterX, pRotationCenterY, 0);
		pGL.glRotatef(pAngle, 0, 0, 1);
		pGL.glTranslatef(-pRotationCenterX, -pRotationCenterY, 0);
	} 
 
	public void convertSceneToCameraSceneTouchEvent(final TouchEvent pSceneTouchEvent) {
		this.unapplySceneRotation(pSceneTouchEvent);