Java Code Examples for android.opengl.GLES11#glPushMatrix()

The following examples show how to use android.opengl.GLES11#glPushMatrix() . 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: ControlledShipIntroScreen.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void performPresent(float deltaTime) {
	inGame.render(deltaTime, allObjects);
	if (!allObjects.isEmpty()) {
		GLES11.glMatrixMode(GLES11.GL_PROJECTION);
		GLES11.glPushMatrix();		
		GLES11.glLoadIdentity();
		Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
		GlUtils.ortho(game, visibleArea);
		GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
		GLES11.glLoadIdentity();
		GLES11.glColor4f(0.937f, 0.396f, 0.0f, 1.0f);
		GLES11.glMatrixMode(GLES11.GL_PROJECTION);
		GLES11.glPopMatrix();
		GLES11.glMatrixMode(GLES11.GL_MODELVIEW);			
	}
}
 
Example 2
Source File: ShipIntroScreen.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void displayShip() {
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();

	initDisplay(visibleArea);

	if (SHOW_DOCKING && coriolis != null) {
		GLES11.glPushMatrix();
		  GLES11.glMultMatrixf(coriolis.getMatrix(), 0);
		  coriolis.render();
		GLES11.glPopMatrix();
	}
	GLES11.glPushMatrix();
	  GLES11.glMultMatrixf(currentShip.getMatrix(), 0);
	  ((Geometry) currentShip).render();
	GLES11.glPopMatrix();
	
	endDisplay(visibleArea);
}
 
Example 3
Source File: HyperspaceRenderer.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void performPresent(float deltaTime) {
       GLES11.glPointSize(2.0f);                
    GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA);
       GLES11.glDisable(GLES11.GL_BLEND);

   	GLES11.glDisable(GLES11.GL_LIGHTING);
	GLES11.glMatrixMode(GLES11.GL_TEXTURE);
   	GLES11.glTranslatef(0.0007f, -0.015f, 0.0f);
   	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glPushMatrix();
	GLES11.glMultMatrixf(cylinder.getMatrix(), 0);
	GLES11.glColor4f(red, green, blue, 1.0f);		
	cylinder.render();
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glPopMatrix();
	GLES11.glPointSize(1.0f);
}
 
Example 4
Source File: InGameManager.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void renderScroller(final float deltaTime) {
	GLES11.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
	GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT);
GLES11.glMatrixMode(GLES11.GL_PROJECTION);
GLES11.glPushMatrix();		
GLES11.glLoadIdentity();
Rect visibleArea = ((AndroidGraphics) alite.getGraphics()).getVisibleArea();
GlUtils.ortho(alite, visibleArea);		

GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
GLES11.glLoadIdentity();
GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
message.render(alite);
if (scrollingText != null) {
	scrollingText.render(deltaTime);
}
GLES11.glMatrixMode(GLES11.GL_PROJECTION);
GLES11.glPopMatrix();
GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
}
 
Example 5
Source File: InGameManager.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
private void renderHud() {
	if (hud == null) {
		return;
	}
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glPushMatrix();		
	GLES11.glLoadIdentity();
	Rect visibleArea = ((AndroidGraphics) alite.getGraphics()).getVisibleArea();
	GlUtils.ortho(alite, visibleArea);		
	
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glLoadIdentity();
	if (playerControl) {
		alite.getCobra().setRotation(deltaYawRollPitch.z, deltaYawRollPitch.y);
	}
	alite.getCobra().setSpeed(ship.getSpeed());
	hud.render();	
	hud.clear();
}
 
Example 6
Source File: EngineExhaust.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void render() {
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glDepthMask(false);
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY);
	GLES11.glDisable(GLES11.GL_LIGHTING);
	GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE);		
	MathHelper.copyMatrix(getMatrix(), saveMatrix);
	for (int i = 0; i < 2; i++) {
		GLES11.glPushMatrix();
		GLES11.glMultMatrixf(getMatrix(), 0);
	
		GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, diskBuffer);
		GLES11.glColorPointer(4, GLES11.GL_FLOAT, 0, colorBuffer1);
		GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 10);
	
		GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, cylinderBuffer);
		GLES11.glColorPointer(4, GLES11.GL_FLOAT, 0, colorBuffer2);
		GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, 18);
	
		GLES11.glPopMatrix();
		scale(0.4f, 0.4f, 1.2f);
	}
	MathHelper.copyMatrix(saveMatrix, currentMatrix);
	extractVectors();
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glEnable(GLES11.GL_LIGHTING);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glDepthMask(true);
	GLES11.glDisable(GLES11.GL_BLEND);
}
 
Example 7
Source File: GLES11DrawContext.java    From settlers-remake with MIT License 5 votes vote down vote up
public void drawTrianglesWithTextureColored(TextureHandle textureid, GeometryHandle vertexHandle, GeometryHandle colorHandle, int offset, int lines, int width, int stride, float x, float y) {
	bindTexture(textureid);
	int starti = offset < 0 ? (int)Math.ceil(-offset/(float)stride) : 0;

	if(lsz != -1) GLES11.glPopMatrix();
	GLES11.glPushMatrix();
	GLES11.glTranslatef(x, y, -.1f);
	GLES11.glScalef(1, 1, 0);
	GLES11.glMultMatrixf(heightMatrix, 0);

	if(!tex_coord_on) {
		GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
		tex_coord_on = true;
	}

	bindGeometry(vertexHandle);
	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 5 * 4, 0);
	GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 5 * 4, 3 * 4);

	bindGeometry(colorHandle);
	GLES11.glColorPointer(4, GLES11.GL_UNSIGNED_BYTE, 0, 0);

	GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY);
	for (int i = starti; i != lines; i++) {
		GLES11.glDrawArrays(GLES11.GL_TRIANGLES, (offset + stride * i) * 3, width * 3);
	}
	GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);

	GLES11.glPopMatrix();
	lsz = -1;
}
 
Example 8
Source File: GLES11DrawContext.java    From settlers-remake with MIT License 5 votes vote down vote up
public void draw2D(GeometryHandle geometry, TextureHandle texture, int primitive, int offset, int vertices, float x, float y, float z, float sx, float sy, float sz, AbstractColor color, float intensity) {
	if(lx != x || ly != y || lz != z || lsx != sx || lsy != sy || lsz != sz) {
		if(lsz != -1) GLES11.glPopMatrix();
		GLES11.glPushMatrix();
		if(x != 0 || y != 0 || z != 0) GLES11.glTranslatef(x, y, z);
		if(sx != 1 || sy != 1 || sz != 1) GLES11.glScalef(sx, sy, sz);
		lx = x; lsx = sx;
		ly = y; lsy = sy;
		lz = z; lsz = sz;
	}

	if(color != null) {
		float r = color.red*intensity;
		float g = color.green*intensity;
		float b = color.blue*intensity;
		float a = color.alpha;
		if(lr != r || lg != g || lb != b || la != a) GLES11.glColor4f(lr=r, lg=g, lb=b, la=a);
	} else {
		if(lr != lg || lr != lb || lr != intensity || la != 1) GLES11.glColor4f(intensity, intensity, intensity, 1);
		lr = lg = lb = intensity;
		la = 1;
	}

	bindTexture(texture);
	bindGeometry(geometry);
	EGeometryFormatType format = geometry.getFormat();

	if(format.getTexCoordPos() == -1) GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);

	specifyFormat(format);
	GLES11.glDrawArrays(primitive, offset * vertices, vertices);

	if(format.getTexCoordPos() == -1) GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
}
 
Example 9
Source File: ShipEditorScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void displayShip() {
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
	float aspectRatio = (float) visibleArea.width() / (float) visibleArea.height();
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);				
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, aspectRatio, 1.0f, 900000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);		
	GLES11.glLoadIdentity();
	
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);

	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT);
	GLES11.glPushMatrix();
	GLES11.glMultMatrixf(currentShip.getMatrix(), 0);
	currentShip.render();		
	GLES11.glPopMatrix();
	
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);		
	GLES11.glDisable(GLES11.GL_TEXTURE_2D);
	setUpForDisplay(visibleArea);
}
 
Example 10
Source File: LaserManager.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
void renderLaser(LaserCylinder laser, final GraphicObject ship) {
	if (laser.isAiming()) {
		return;
	}
	alite.getTextureManager().setTexture(null);
	GLES11.glPushMatrix();
	laser.render(alite);
    GLES11.glPopMatrix();
    laser.postRender();
}
 
Example 11
Source File: Explosion.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void render() {
	if (finished || rendered) {
		return;
	}
	GLES11.glColor4f(0.94f, 0, 0, 1.0f);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glDepthMask(false);		
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE);		
	for (int i = 0; i < 3; i++) {
		if (explosions[i] == null) {
			continue;
		}
		GLES11.glPushMatrix();
		GLES11.glMultMatrixf(explosions[i].getMatrix(), 0);
		explosions[i].batchRender();
		GLES11.glPopMatrix();
	}		
	Alite.get().getTextureManager().setTexture(null);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glDepthMask(true);
	GLES11.glDisable(GLES11.GL_BLEND);
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	rendered = true;
}
 
Example 12
Source File: PlanetScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void afterDisplay() {		
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
	float aspectRatio = (float) visibleArea.width() / (float) visibleArea.height();
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);				
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, aspectRatio, 20000.0f, 1000000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);		
	GLES11.glLoadIdentity();
	
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);

	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT);
	GLES11.glPushMatrix();
	GLES11.glMultMatrixf(planet.getMatrix(), 0);
	planet.render();
	GLES11.glPopMatrix();
	
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);		
	GLES11.glDisable(GLES11.GL_TEXTURE_2D);
	setUpForDisplay(visibleArea);
	
}
 
Example 13
Source File: ShipIntroScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
private void initDisplay(final Rect visibleArea) {
	float aspectRatio = (float) visibleArea.width() / (float) visibleArea.height();
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, aspectRatio, 1.0f, 900000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glLoadIdentity();

	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glPushMatrix();
	  GLES11.glMultMatrixf(skysphere.getMatrix(), 0);
      skysphere.render();
	GLES11.glPopMatrix();

	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT);

	GLES11.glDisable(GLES11.GL_BLEND);
}
 
Example 14
Source File: CougarScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void displayShip() {
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
	float aspectRatio = (float) visibleArea.width() / (float) visibleArea.height();
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);				
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, aspectRatio, 1.0f, 100000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);		
	GLES11.glLoadIdentity();
	
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);

	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT);
	GLES11.glPushMatrix();
	GLES11.glMultMatrixf(cougar.getMatrix(), 0);
	cougar.render();
	GLES11.glPopMatrix();
	
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);		
	GLES11.glDisable(GLES11.GL_TEXTURE_2D);
	setUpForDisplay(visibleArea);
}
 
Example 15
Source File: ConstrictorScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void displayShip() {
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
	float aspectRatio = (float) visibleArea.width() / (float) visibleArea.height();
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);				
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, aspectRatio, 1.0f, 100000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);		
	GLES11.glLoadIdentity();
	
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);

	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT);
	GLES11.glPushMatrix();
	GLES11.glMultMatrixf(constrictor.getMatrix(), 0);
	constrictor.render();
	GLES11.glPopMatrix();
	
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);		
	GLES11.glDisable(GLES11.GL_TEXTURE_2D);
	setUpForDisplay(visibleArea);
}
 
Example 16
Source File: LaserCylinder.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
public void render(Alite alite) {
	if (!visible) {
		return;
	}
	GLES11.glDepthFunc(GLES11.GL_LEQUAL);
	GLES11.glDepthMask(false);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	if (textureFilename != null) {
		GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
		GLES11.glEnable(GLES11.GL_LIGHTING);
		alite.getTextureManager().setTexture(textureFilename);
	} else {
		GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
		GLES11.glDisable(GLES11.GL_LIGHTING);
		alite.getTextureManager().setTexture(null);
	}			
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE);
	GLES11.glColor4f(emission[0], emission[1], emission[2], emission[3]);
	for (int i = 0; i < 2; i++) {
		GLES11.glPushMatrix();
		GLES11.glMultMatrixf(getMatrix(), 0);
	
		GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, diskBuffer1);
		GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer[0]);
		if (textureFilename != null) {
			GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer[0]);
		}
		GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 10);
				
		GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, cylinderBuffer);
		GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer[1]);
		if (textureFilename != null) {
			GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer[1]);
		}
		GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, 18);
	
		GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, diskBuffer2);
		GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer[2]);
		if (textureFilename != null) {
			GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer[2]);
		}
		GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 10);

		GLES11.glPopMatrix();
		MathHelper.copyMatrix(getMatrix(), saveMatrix);
		scale(0.7f, 0.7f, 0.7f);			
		GLES11.glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
	}
	MathHelper.copyMatrix(saveMatrix, currentMatrix);
	extractVectors();
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glEnable(GLES11.GL_LIGHTING);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	alite.getTextureManager().setTexture(null);
	GLES11.glDepthFunc(GLES11.GL_LESS);
	GLES11.glDepthMask(true);
	GLES11.glDisable(GLES11.GL_BLEND);
}
 
Example 17
Source File: InGameManager.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
public void render(final float deltaTime, final List <AliteObject> objects) {
	GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT);

	if (destroyed) {
		return;
	}
	if (laserManager == null) {
		return;
	}
	if (hud != null) {
		hud.setViewDirection(viewDirection);
	}
	performViewTransformation(deltaTime);
	viewingTransformationHelper.clearObjects(sortedObjectsToDraw);
	hudIndex = 0;
	planetWasSet = false;
	if (viewDirection != 0) {			
		MathHelper.copyMatrix(viewMatrix, tempMatrix[0]);			
		for (AliteObject go: objects) {
			MathHelper.copyMatrix(tempMatrix[0], viewMatrix);
			renderHudObject(deltaTime, go);
		}
		MathHelper.copyMatrix(tempMatrix[0], viewMatrix);
		viewingTransformationHelper.applyViewDirection(viewDirection, viewMatrix);
	}
	MathHelper.copyMatrix(viewMatrix, tempMatrix[0]);
	
	viewingTransformationHelper.sortObjects(objects, viewMatrix, tempMatrix[2], laserManager.activeLasers, sortedObjectsToDraw, witchSpace != null, ship);
	try {
		renderAllObjects(deltaTime, sortedObjectsToDraw);
	} catch (ConcurrentModificationException e) {
		// Ignore...
		// This can happen if the game state is being paused while the current
		// screen is being rendered. Ignoring it is a bit of a hack, but gets
		// rid of the issue...
	}

	if (hud != null) {
		if (dockingComputerAI.isActive()) {
			hud.mapDirections(alite.getCobra().getRoll() > 0.1,
					          alite.getCobra().getRoll() < -0.1,
					          alite.getCobra().getPitch() < -0.1,
					          alite.getCobra().getPitch() > 0.1);
		}
		renderHud();
		GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		if (message == null) {
			message = new OnScreenMessage();
		}
		message.render(alite);
		if (scrollingText != null) {
			scrollingText.render(deltaTime);
		} else if (feeText != null) {
			GLES11.glColor4f(0.94f, 0.94f, 0.0f, 0.6f);
			alite.getFont().drawText(feeText, 960, 150, true, 1.0f);
			GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			buttons.renderYesNoButtons();
		}
		if (Settings.displayFrameRate) {
			OnScreenDebug.debugFPS(alite);
		}
		if (Settings.displayDockingInformation) {
			OnScreenDebug.debugDocking(alite, ship, sortedObjectsToDraw);
		}
		renderButtons();			
	} else {
		GLES11.glMatrixMode(GLES11.GL_PROJECTION);
		GLES11.glPushMatrix();		
		GLES11.glLoadIdentity();
		Rect visibleArea = ((AndroidGraphics) alite.getGraphics()).getVisibleArea();
		GlUtils.ortho(alite, visibleArea);
		
		GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
		GLES11.glLoadIdentity();
		GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		message.render(alite);
		if (scrollingText != null) {
			scrollingText.render(deltaTime);
		}
		GLES11.glMatrixMode(GLES11.GL_PROJECTION);
		GLES11.glPopMatrix();
		GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	}		
}
 
Example 18
Source File: AboutScreen.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void performPresent(float deltaTime) {
	if (isDisposed) {
		return;
	}
	GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT | GLES11.GL_DEPTH_BUFFER_BIT);
       GLES11.glClearDepthf(1.0f);

       GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
       GLES11.glLoadIdentity();                    

       GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glPushMatrix();		
	GLES11.glLoadIdentity();
	Rect visibleArea = ((AndroidGraphics) ((Alite) game).getGraphics()).getVisibleArea();
	GlUtils.ortho(game, visibleArea);		
	
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glLoadIdentity();
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);		
	GLES11.glColor4f(globalAlpha, globalAlpha, globalAlpha, globalAlpha);
	background.render();
       GLES11.glColor4f(globalAlpha * alpha, globalAlpha * alpha, globalAlpha * alpha, globalAlpha * alpha);
       aliteLogo.render();
       if (y < 1200) {
       	int i = 0;
       	for (TextData text: texts) {
       		i++;
       		if (y + text.y > -120) {
           		if (y + text.y > 1080) {
           			break;
           		}
           		setGlColor(text.color);
           		font.drawText(text.text, text.x, y + text.y, true, text.scale);
           		if (y + text.y < 525 && i == texts.size() - 1) {
           			end = true;
           		}
       		}
       	}
       }
       GLES11.glColor4f(globalAlpha, globalAlpha, globalAlpha, globalAlpha);
       ((Alite) game).getFont().drawText("Alite Version " + Alite.VERSION_STRING, 0, 1030, false, 1.0f);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glPopMatrix();
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	
       GLES11.glDisable(GLES11.GL_TEXTURE_2D);
	GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, 0);
}