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

The following examples show how to use org.andengine.opengl.util.GLState#loadModelViewGLMatrixIdentity() . 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: TextureWarmUpVertexBufferObject.java    From tilt-game-android with MIT License 6 votes vote down vote up
public void warmup(final GLState pGLState, final ITexture pTexture) {
	pTexture.bind(pGLState);
	this.bind(pGLState, PositionTextureCoordinatesShaderProgram.getInstance());

	pGLState.pushModelViewGLMatrix();
	{
		/* Far far away and really small. */
		pGLState.loadModelViewGLMatrixIdentity();
		pGLState.translateModelViewGLMatrixf(1000000, 1000000, 0);
		pGLState.scaleModelViewGLMatrixf(0.0001f, 0.0001f, 0);

		this.draw(GLES20.GL_TRIANGLES, TextureWarmUpVertexBufferObject.VERTICES_PER_VERTEXBUFFEROBJECT_SIZE);
	}
	pGLState.popModelViewGLMatrix();

	this.unbind(pGLState, PositionTextureCoordinatesShaderProgram.getInstance());
}
 
Example 2
Source File: TextureWarmUpVertexBufferObject.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
public void warmup(final GLState pGLState, final ITexture pTexture) {
	pTexture.bind(pGLState);
	this.bind(pGLState, PositionTextureCoordinatesShaderProgram.getInstance());

	pGLState.pushModelViewGLMatrix();
	{
		/* Far far away and really small. */
		pGLState.loadModelViewGLMatrixIdentity();
		pGLState.translateModelViewGLMatrixf(1000000, 1000000, 0);
		pGLState.scaleModelViewGLMatrixf(0.0001f, 0.0001f, 0);

		this.draw(GLES20.GL_TRIANGLES, VERTICES_PER_VERTEXBUFFEROBJECT_SIZE);
	}
	pGLState.popModelViewGLMatrix();

	this.unbind(pGLState, PositionTextureCoordinatesShaderProgram.getInstance());
}
 
Example 3
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 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: 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 6
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();
}