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

The following examples show how to use android.opengl.GLES11#glEnable() . 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: TargetBox.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void render() {
	alite.getTextureManager().setTexture(null);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, lineBuffer);		
	GLES11.glColor4f(r, g, b, a);
	GLES11.glDisable(GLES11.GL_LIGHTING);
	GLES11.glLineWidth(5);
	GLES11.glDrawArrays(GLES11.GL_LINES, 0, 24);
	GLES11.glLineWidth(1);
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glEnable(GLES11.GL_LIGHTING);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
}
 
Example 2
Source File: AboutScreen.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
private void initializeGl() {
	float ratio = (float) windowWidth / (float) windowHeight;	     
       GLES11.glMatrixMode(GLES11.GL_PROJECTION);
       GlUtils.setViewport(visibleArea);
       GLES11.glLoadIdentity();
       GlUtils.gluPerspective(game, 45.0f, ratio, 10.0f, 1000.0f);
       GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
       GLES11.glLoadIdentity();        
       GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
       GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT | GLES11.GL_DEPTH_BUFFER_BIT);
       GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST);		        
       GLES11.glEnable(GLES11.GL_DEPTH_TEST);
       GLES11.glDepthFunc(GLES11.GL_LEQUAL);
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE);
}
 
Example 3
Source File: Disk.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void render() {
	GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer);
	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, vertexBuffer);
	if (textureFilename != null) {
		GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer);
		alite.getTextureManager().setTexture(textureFilename);
	} else {
		GLES11.glDisable(GLES11.GL_LIGHTING);
		GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);			
	}
	GLES11.glDrawArrays(glDrawMode, 0, numberOfVertices);
	if (textureFilename == null) {
		GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
		GLES11.glEnable(GLES11.GL_LIGHTING);
	}
}
 
Example 4
Source File: HyperspaceScreen.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
public void initializeGl(Rect visibleArea) {				
	float ratio = (float) windowWidth / (float) windowHeight;
     
	GlUtils.setViewport(visibleArea);
       GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
       GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
       GLES11.glPointSize(2.0f);

       GLES11.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_MODULATE);
       
    GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA);
       GLES11.glDisable(GLES11.GL_BLEND);

       GLES11.glMatrixMode(GLES11.GL_PROJECTION);
       GLES11.glLoadIdentity();
       GlUtils.gluPerspective(game, 120f, ratio, 0.01f, 100f);
       GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
       GLES11.glLoadIdentity();        
       GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
       GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
       
       GLES11.glEnable(GLES11.GL_TEXTURE_2D);
       GLES11.glEnable(GLES11.GL_DEPTH_TEST);        
       ((Alite) game).getTextureManager().setTexture(textureFilename);
       GLES11.glDisable(GLES11.GL_LIGHTING);
}
 
Example 5
Source File: StarDust.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
void render() {		
       GLES11.glEnable(GLES11.GL_FOG);
	GLES11.glDisable(GLES11.GL_CULL_FACE);
       GLES11.glDisable(GLES11.GL_LIGHTING);
	GLES11.glDisableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_POINT_SIZE_ARRAY_OES);		
	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, dustParticles);
	GLES11.glPointSizePointerOES(GLES11.GL_FLOAT, 0, particleSizes);
	GLES11.glColor4f(0.7f, 0.7f, 1.0f, 0.8f);
	alite.getTextureManager().setTexture("textures/glow_mask.png");
       GLES11.glEnable(GLES11.GL_POINT_SPRITE_OES);
       GLES11.glTexEnvf(GLES11.GL_POINT_SPRITE_OES, GLES11.GL_COORD_REPLACE_OES, GLES11.GL_TRUE);
       GLES11.glEnable(GLES11.GL_BLEND);
       GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE);
       GLES11.glHint(GLES11.GL_POINT_SMOOTH_HINT, GLES11.GL_NICEST);
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);
	GLES11.glDrawArrays(GLES11.GL_POINTS, 0, particleCount);
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glPointSize(1.0f);
	GLES11.glDisableClientState(GLES11.GL_POINT_SIZE_ARRAY_OES);
	GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glEnable(GLES11.GL_LIGHTING);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glDisable(GLES11.GL_BLEND);
	GLES11.glDisable(GLES11.GL_FOG);
}
 
Example 6
Source File: SkySphereSpaceObject.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render() {
	if (additionalParameters != null) {
		additionalParameters.setUp();
	}
	GLES11.glDisable(GLES11.GL_DEPTH_TEST);
	sphere.render();
	GLES11.glEnable(GLES11.GL_DEPTH_TEST);
	if (additionalParameters != null) {
		additionalParameters.tearDown();
	}
}
 
Example 7
Source File: HyperspaceScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void performPresent(float deltaTime) {
	if (isDisposed) {
		return;
	}
	GLES11.glDisable(GLES11.GL_CULL_FACE);
       GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT | GLES11.GL_DEPTH_BUFFER_BIT);
       
       counter += 0.72f;
       if (counter > 360) {
       	counter = 0;
       }
       switch (increase) {
       	case 0: red += 0.002f; if (red > 1.0f) red = 1.0f; break;
       	case 1: green += 0.002f; if (green > 1.0f) green = 1.0f; break;
       	case 2: blue += 0.002f; if (blue > 1.0f) blue = 1.0f; break;
       }
       GLES11.glLoadIdentity();
       lookAt(-3.5f, 0, 0,
       	   -3.5f, 1.0f, 0,
       	   (float) Math.sin(Math.toRadians(counter)), 0.0f, (float) Math.cos(Math.toRadians(counter)));
       
       GLES11.glRotatef(counter * 2, 0.0f, 0.0f, 1.0f);
   	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, vertexBuffer);
   	GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, textureBuffer); 
   	
   	GLES11.glMatrixMode(GLES11.GL_TEXTURE);
   	GLES11.glTranslatef(0.0f, -0.015f, 0.0f);
   	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);

   	GLES11.glColor4f(red, green, blue, 1.0f);
   	GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, totalIndices);
   	GLES11.glEnable(GLES11.GL_CULL_FACE);
   	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
 
Example 8
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 9
Source File: Sprite.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
protected void setUp() {
	GLES11.glDisable(GLES11.GL_LIGHTING);
	GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	
	GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, vertexBuffer);
	GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer);

	alite.getTextureManager().setTexture(textureFilename);
	
	GLES11.glDisable(GLES11.GL_CULL_FACE);
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA);
}
 
Example 10
Source File: SpaceObject.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void renderTargetBox(float distSq) {
	if (!Settings.targetBox || targetBox == null || distSq <= SpaceObjectAI.SHOOT_DISTANCE_SQ) {
		return;
	}
	float alpha = (distSq - SpaceObjectAI.SHOOT_DISTANCE_SQ) / (LaserManager.MAX_ENEMY_DISTANCE_SQ - SpaceObjectAI.SHOOT_DISTANCE_SQ);
	targetBox.setAlpha(alpha);
	GLES11.glEnable(GLES11.GL_BLEND);
	GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE);
	targetBox.render();
	GLES11.glDisable(GLES11.GL_BLEND);
}
 
Example 11
Source File: IcosDockingBay.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
void render() {
	boolean enabled = GLES11.glIsEnabled(GLES11.GL_CULL_FACE);
	if (enabled) {
		GLES11.glDisable(GLES11.GL_CULL_FACE);
	}
	alite.getTextureManager().setTexture(textureFilename);
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, vertexBuffer);
	GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer);
	GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer);		
	GLES11.glDrawArrays(GLES11.GL_TRIANGLES, 0, numberOfVertices);
	if (enabled) {
		GLES11.glEnable(GLES11.GL_CULL_FACE);
	}		
}
 
Example 12
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 13
Source File: TutorialScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void postNavigationRender(float deltaTime) {
	if (currentLine != null) {
		GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA);
		GLES11.glEnable(GLES11.GL_BLEND);
		currentLine.renderHighlights(deltaTime);
		GLES11.glDisable(GLES11.GL_BLEND);
	}		
}
 
Example 14
Source File: Sprite.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
protected void cleanUp() {
	GLES11.glDisable(GLES11.GL_BLEND);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glEnable(GLES11.GL_LIGHTING);

	GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glDisableClientState(GLES11.GL_VERTEX_ARRAY);
	GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, 0);
}
 
Example 15
Source File: GLText.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void begin(float red, float green, float blue, float alpha) {
	GLES11.glColor4f(red, green, blue, alpha); // Set Color+Alpha
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, textureId); // Bind the
															// Texture
	batch.beginBatch(); // Begin Batch
}
 
Example 16
Source File: AutomaticLaunchScreen.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void performPresent(float deltaTime) {
	if (isDisposed) {
		return;
	}
	GLES11.glDisable(GLES11.GL_CULL_FACE);
       GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT | GLES11.GL_DEPTH_BUFFER_BIT);
       
       counter += 0.72f;
       if (counter > 360) {
       	counter = 0;
       }
       switch (increase) {
       	case 0: red += 0.002f; if (red > 1.0f) red = 1.0f; break;
       	case 1: green += 0.002f; if (green > 1.0f) green = 1.0f; break;
       	case 2: blue += 0.002f; if (blue > 1.0f) blue = 1.0f; break;
       }
       GLES11.glLoadIdentity();
       lookAt(-3.5f, 0, 0,
       	   -3.5f, 1.0f, 0,
       	   (float) Math.sin(Math.toRadians(counter)), 0.0f, (float) Math.cos(Math.toRadians(counter)));
       
       GLES11.glRotatef(counter * 2, 0.0f, 0.0f, 1.0f);
   	GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, vertexBuffer);
   	GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, textureBuffer); 
   	
   	GLES11.glMatrixMode(GLES11.GL_TEXTURE);
   	GLES11.glTranslatef(0.0f, -0.015f, 0.0f);
   	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);

   	GLES11.glColor4f(red, green, blue, 1.0f);
   	GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, totalIndices);
   	GLES11.glEnable(GLES11.GL_CULL_FACE);
   	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
 
Example 17
Source File: ShipEditorScreen.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
private void initGl() {
	Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea();
	int windowWidth = visibleArea.width();
	int windowHeight = visibleArea.height();

	float ratio = (float) windowWidth / (float) windowHeight;
	GlUtils.setViewport(visibleArea);
	GLES11.glDisable(GLES11.GL_FOG);
	GLES11.glPointSize(1.0f);
       GLES11.glLineWidth(1.0f);

       GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA);
       GLES11.glDisable(GLES11.GL_BLEND);
       
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glLoadIdentity();

	GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	GLES11.glShadeModel(GLES11.GL_SMOOTH);
	
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0);
	GLES11.glEnable(GLES11.GL_LIGHT1);

	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0);
	GLES11.glEnable(GLES11.GL_LIGHT2);

	GLES11.glEnable(GLES11.GL_LIGHTING);
	
	GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT);
	GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST);
	GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST);
	GLES11.glEnable(GLES11.GL_CULL_FACE);	
}
 
Example 18
Source File: FlightScreen.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
public void initializeGl(final Rect visibleArea) {		
	float ratio = (float) windowWidth / (float) windowHeight;
	GlUtils.setViewport(visibleArea);
	GLES11.glDisable(GLES11.GL_FOG);
	GLES11.glPointSize(1.0f);
       GLES11.glLineWidth(1.0f);

       GLES11.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_MODULATE);
       
    GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA);
       GLES11.glDisable(GLES11.GL_BLEND);
       
	GLES11.glMatrixMode(GLES11.GL_PROJECTION);
	GLES11.glLoadIdentity();
	GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f);
	GLES11.glMatrixMode(GLES11.GL_MODELVIEW);
	GLES11.glLoadIdentity();

	GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	GLES11.glShadeModel(GLES11.GL_SMOOTH);
	
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0);
	GLES11.glEnable(GLES11.GL_LIGHT1);

	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0);
	GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0);
	GLES11.glEnable(GLES11.GL_LIGHT2);

	GLES11.glEnable(GLES11.GL_LIGHTING);
	
	GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT);
	GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST);
	GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST);
	GLES11.glEnable(GLES11.GL_TEXTURE_2D);
	GLES11.glEnable(GLES11.GL_CULL_FACE);			
}
 
Example 19
Source File: AliteHud.java    From Alite with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render() {
	
	setUp();
	GLES11.glColor4f(Settings.alpha, Settings.alpha, Settings.alpha, Settings.alpha);
	GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, 4);

	computeLaser();
	if (currentLaserIndex >= 0) {
		laser.simpleRender();
	}
	if (!witchSpace) {
		compass.render();
	}

	infoGauges.render();
	GLES11.glColor4f(Settings.alpha, Settings.alpha, Settings.alpha, Settings.alpha);
	aliteText.justRender();
	if (safeZone) {
		safeIcon.justRender();
	}
	if (System.currentTimeMillis() < ecmActive) {
		ecmIcon.justRender();
	}
	
	if (Settings.controlMode == ShipControl.CONTROL_PAD && controlPad != null) {
		controlPad.render();
	} else if ((Settings.controlMode == ShipControl.CURSOR_BLOCK || Settings.controlMode == ShipControl.CURSOR_SPLIT_BLOCK) && controlKeys != null) {
		controlKeys.render();
	}
	
	GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE);
	switch (viewDirection) {
		case 0: frontViewport.justRender(); break;
		case 1: rightViewport.justRender(); break;
		case 2: rearViewport.justRender();  break;
		case 3: leftViewport.justRender();  break;
	}
	
	GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
	GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, 0);			
	renderLollipops();
	if (zoomFactor > 1.5f && zoomFactor < 3.0f) {
		GLES11.glColor4f(0.94f * Settings.alpha, 0.94f * Settings.alpha, 0.0f, 0.6f * Settings.alpha);
		alite.getFont().drawText("x2", RADAR_X1 + 20, RADAR_Y1 + 20, false, 1.0f);			
	} else if (zoomFactor > 3.0f) {
		GLES11.glColor4f(0.94f * Settings.alpha, 0.94f * Settings.alpha, 0.0f, 0.6f * Settings.alpha);
		alite.getFont().drawText("x4", RADAR_X1 + 20, RADAR_Y1 + 20, false, 1.0f);				
	}
	GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GLES11.glDisable(GLES11.GL_BLEND);
	GLES11.glEnable(GLES11.GL_CULL_FACE);
	GLES11.glEnable(GLES11.GL_LIGHTING);

	GLES11.glDisableClientState(GLES11.GL_VERTEX_ARRAY);
	cleanUp();
	
}
 
Example 20
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);
}