Java Code Examples for org.andengine.opengl.util.GLState#orthoProjectionGLMatrixf()

The following examples show how to use org.andengine.opengl.util.GLState#orthoProjectionGLMatrixf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Camera.java    From tilt-game-android with MIT License 5 votes vote down vote up
public void onApplySceneMatrix(final GLState pGLState) {
	pGLState.orthoProjectionGLMatrixf(this.getXMin(), this.getXMax(), this.getYMin(), this.getYMax(), this.mZNear, this.mZFar);

	final float rotation = this.mRotation;
	if (rotation != 0) {
		this.applyRotation(pGLState, this.getCenterX(), this.getCenterY(), rotation);
	}
}
 
Example 2
Source File: Camera.java    From tilt-game-android with MIT License 5 votes vote down vote up
public void onApplySceneBackgroundMatrix(final GLState pGLState) {
	final float cameraSceneWidth = this.getCameraSceneWidth();
	final float cameraSceneHeight = this.getCameraSceneHeight();

	pGLState.orthoProjectionGLMatrixf(0, cameraSceneWidth, 0, cameraSceneHeight, this.mZNear, this.mZFar);

	final float rotation = this.mRotation;
	if (rotation != 0) {
		this.applyRotation(pGLState, cameraSceneWidth * 0.5f, cameraSceneHeight * 0.5f, rotation);
	}
}
 
Example 3
Source File: Camera.java    From tilt-game-android with MIT License 5 votes vote down vote up
public void onApplyCameraSceneMatrix(final GLState pGLState) {
	final float cameraSceneWidth = this.getCameraSceneWidth();
	final float cameraSceneHeight = this.getCameraSceneHeight();
	pGLState.orthoProjectionGLMatrixf(0, cameraSceneWidth, 0, cameraSceneHeight, this.mZNear, this.mZFar);

	final float cameraSceneRotation = this.mCameraSceneRotation;
	if (cameraSceneRotation != 0) {
		this.applyRotation(pGLState, cameraSceneWidth * 0.5f, cameraSceneHeight * 0.5f, cameraSceneRotation);
	}
}
 
Example 4
Source File: RenderTexture.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @see {@link #end(GLState)},
 * 		{@link #end(GLState, boolean, boolean}}.
 */
public void begin(final GLState pGLState, final boolean pFlipX, final boolean pFlipY) {
	this.savePreviousViewport();
	GLES20.glViewport(0, 0, this.mWidth, this.mHeight);

	pGLState.pushProjectionGLMatrix();

	final float left;
	final float right;
	final float bottom;
	final float top;
	if (pFlipX) {
		left = this.mWidth;
		right = 0;
	} else {
		left = 0;
		right = this.mWidth;
	}
	if (pFlipY) {
		top = 0;
		bottom = this.mHeight;
	} else {
		top = this.mHeight;
		bottom = 0;
	}
	pGLState.orthoProjectionGLMatrixf(left, right, bottom, top, -1, 1);

	this.savePreviousFramebufferObjectID(pGLState);
	pGLState.bindFramebuffer(this.mFramebufferObjectID);

	pGLState.pushModelViewGLMatrix();
	pGLState.loadModelViewGLMatrixIdentity();
}
 
Example 5
Source File: Camera.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public void onApplySceneMatrix(final GLState pGLState) {
	pGLState.orthoProjectionGLMatrixf(this.getXMin(), this.getXMax(), this.getYMax(), this.getYMin(), this.mZNear, this.mZFar);

	final float rotation = this.mRotation;
	if(rotation != 0) {
		Camera.applyRotation(pGLState, this.getCenterX(), this.getCenterY(), rotation);
	}
}
 
Example 6
Source File: Camera.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public void onApplySceneBackgroundMatrix(final GLState pGLState) {
	final float widthRaw = this.getWidthRaw();
	final float heightRaw = this.getHeightRaw();

	pGLState.orthoProjectionGLMatrixf(0, widthRaw, heightRaw, 0, this.mZNear, this.mZFar);

	final float rotation = this.mRotation;
	if(rotation != 0) {
		Camera.applyRotation(pGLState, widthRaw * 0.5f, heightRaw * 0.5f, rotation);
	}
}
 
Example 7
Source File: Camera.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public void onApplyCameraSceneMatrix(final GLState pGLState) {
	final float widthRaw = this.getWidthRaw();
	final float heightRaw = this.getHeightRaw();
	pGLState.orthoProjectionGLMatrixf(0, widthRaw, heightRaw, 0, this.mZNear, this.mZFar);

	final float cameraSceneRotation = this.mCameraSceneRotation;
	if(cameraSceneRotation != 0) {
		Camera.applyRotation(pGLState, widthRaw * 0.5f, heightRaw * 0.5f, cameraSceneRotation);
	}
}
 
Example 8
Source File: RenderTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
/**
 * @see {@link RenderTexture#end(GLState)},
 * 		{@link RenderTexture#end(GLState, boolean, boolean}}.
 */
public void begin(final GLState pGLState, final boolean pFlipX, final boolean pFlipY) {
	this.savePreviousViewport();
	GLES20.glViewport(0, 0, this.mWidth, this.mHeight);

	pGLState.pushProjectionGLMatrix();

	final float left;
	final float right;
	final float bottom;
	final float top;
	if(pFlipX) {
		left = this.mWidth;
		right = 0;
	} else {
		left = 0;
		right = this.mWidth;
	}
	if(pFlipY) {
		top = this.mHeight;
		bottom = 0;
	} else {
		top = 0;
		bottom = this.mHeight;
	}
	pGLState.orthoProjectionGLMatrixf(left, right, bottom, top, -1, 1);

	this.savePreviousFramebufferObjectID(pGLState);
	pGLState.bindFramebuffer(this.mFramebufferObjectID);

	pGLState.pushModelViewGLMatrix();
	pGLState.loadModelViewGLMatrixIdentity();
}