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

The following examples show how to use org.andengine.opengl.util.GLState#pushProjectionGLMatrix() . 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: Scene.java    From tilt-game-android with MIT License 5 votes vote down vote up
@Override
protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
	final Scene childScene = this.mChildScene;

	if (childScene == null || !this.mChildSceneModalDraw) {
		if (this.mBackgroundEnabled) {
			pGLState.pushProjectionGLMatrix();

			pCamera.onApplySceneBackgroundMatrix(pGLState);
			pGLState.loadModelViewGLMatrixIdentity();

			this.mBackground.onDraw(pGLState, pCamera);

			pGLState.popProjectionGLMatrix();
		}

		{
			pGLState.pushProjectionGLMatrix();

			this.onApplyMatrix(pGLState, pCamera);
			pGLState.loadModelViewGLMatrixIdentity();

			super.onManagedDraw(pGLState, pCamera);

			pGLState.popProjectionGLMatrix();
		}
	}

	if (childScene != null) {
		childScene.onDraw(pGLState, pCamera);
	}
}
 
Example 2
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 3
Source File: Scene.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
	final Scene childScene = this.mChildScene;

	if(childScene == null || !this.mChildSceneModalDraw) {
		if(this.mBackgroundEnabled) {
			pGLState.pushProjectionGLMatrix();

			pCamera.onApplySceneBackgroundMatrix(pGLState);
			pGLState.loadModelViewGLMatrixIdentity();

			this.mBackground.onDraw(pGLState, pCamera);

			pGLState.popProjectionGLMatrix();
		}

		{
			pGLState.pushProjectionGLMatrix();

			this.onApplyMatrix(pGLState, pCamera);
			pGLState.loadModelViewGLMatrixIdentity();

			super.onManagedDraw(pGLState, pCamera);

			pGLState.popProjectionGLMatrix();
		}
	}

	if(childScene != null) {
		childScene.onDraw(pGLState, pCamera);
	}
}
 
Example 4
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();
}