Java Code Examples for android.opengl.GLES11#glClear()
The following examples show how to use
android.opengl.GLES11#glClear() .
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: AboutScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
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 2
Source File: InGameManager.java From Alite with GNU General Public License v3.0 | 6 votes |
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 3
Source File: ShipEditorScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
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 4
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 5 votes |
@Override public void clear(long color) { int alpha = (int) ((color & 0xFF000000l) >> 24); int red = (int) (color & 0x00FF0000) >> 16; int green = (int) (color & 0x0000FF00) >> 8; int blue = (int) (color & 0x000000FF); GLES11.glClearColor(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); }
Example 5
Source File: AboutScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
@Override public void performUpdate(float deltaTime) { if (mode == 0) { performFadeIn(deltaTime); } else if (mode == 1) { performWait(3000000000l); } else if (mode == 2) { performFadeOut(deltaTime); } else if (mode == 3 || mode == 4) { performUpdateLines(deltaTime); } if (returnToOptions) { globalAlpha *= 0.95f; musicVolume *= 0.95f; endCreditsMusic.setVolume(musicVolume); } for (TouchEvent event: game.getInput().getTouchEvents()) { if (event.type == TouchEvent.TOUCH_DOWN && !returnToOptions) { SoundManager.play(Assets.click); returnToOptions = true; } } if (returnToOptions && globalAlpha < 0.01) { GLES11.glClear(GLES11.GL_DEPTH_BUFFER_BIT | GLES11.GL_COLOR_BUFFER_BIT); GLES11.glDisable(GLES11.GL_DEPTH_TEST); game.setScreen(new OptionsScreen(game)); } }
Example 6
Source File: CougarScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
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 7
Source File: ShipIntroScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
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 8
Source File: AutomaticLaunchScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
@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 9
Source File: PlanetScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
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 10
Source File: HyperspaceScreen.java From Alite with GNU General Public License v3.0 | 5 votes |
@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 11
Source File: ControlledShipIntroScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initializeGl(final Rect visibleArea) { AliteLog.d("Ship Intro Screen", "Initialize GL. glError: " + GLES11.glGetError()); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); AliteLog.d("Ship Intro Screen", "Initialize GL lineWidth. glError: " + GLES11.glGetError()); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); AliteLog.d("SIS", "Blending: " + GLES11.glGetError()); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); AliteLog.d("SIS", "Matrix Setup: " + GLES11.glGetError()); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); AliteLog.d("SIS", "Clear Color & Shading Model: " + GLES11.glGetError()); 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); AliteLog.d("SIS", "Defined Light 1: " + GLES11.glGetError()); 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); AliteLog.d("SIS", "Defined Light 2: " + GLES11.glGetError()); GLES11.glEnable(GLES11.GL_LIGHTING); AliteLog.d("SIS", "After Enable Lighting: " + GLES11.glGetError()); AliteLog.d("SIS", "After Lighting: " + GLES11.glGetError()); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glEnable(GLES11.GL_TEXTURE_2D); GLES11.glEnable(GLES11.GL_CULL_FACE); AliteLog.d("SIS", "End of Init: " + GLES11.glGetError()); }
Example 12
Source File: NavigationBar.java From Alite with GNU General Public License v3.0 | 4 votes |
public void render(Graphics g) { if (AndroidGame.resetting) { GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); return; } int counter = 0; int positionCounter = 0; int selX = -1; int selY = -1; for (NavigationEntry entry: targets) { if (!entry.visible) { counter++; continue; } if ((counter * SIZE + SIZE) < position) { counter++; positionCounter++; continue; } int halfWidth = g.getTextWidth(entry.title, Assets.regularFont) >> 1; int halfHeight = g.getTextHeight(entry.title, Assets.regularFont) >> 1; int y = positionCounter * SIZE - position + 1; int x = 1920 - SIZE; g.gradientRect(x + 5, y + 5, SIZE - 6, SIZE - 6, true, true, AliteColors.get().backgroundLight(), AliteColors.get().backgroundDark()); if (entry.image != null) { g.drawPixmap(entry.image, x + 5, y + 5); } if (counter == activeIndex) { selX = x; selY = y; } if (counter == highlightedPosition) { g.rec3d(x, y, SIZE, SIZE, 5, counter == activeIndex ? AliteColors.get().selectedColoredFrameLight() : AliteColors.get().activeColoredFrameLight(), counter == activeIndex ? AliteColors.get().selectedColoredFrameDark() : AliteColors.get().activeColoredFrameDark()); } else { g.rec3d(x, y, SIZE, SIZE, 5, counter == activeIndex ? AliteColors.get().selectedColoredFrameLight() : AliteColors.get().coloredFrameLight(), counter == activeIndex ? AliteColors.get().selectedColoredFrameDark() : AliteColors.get().coloredFrameDark()); } y = positionCounter * SIZE; long color = counter == activeIndex ? AliteColors.get().selectedText() : AliteColors.get().message(); int yPos = entry.image == null ? (int) (y + (SIZE >> 1) - halfHeight + Assets.regularFont.getSize() / 2) - position : (int) (y + SIZE - position - 10); g.drawText(entry.title, 1920 - (SIZE >> 1) - halfWidth, yPos, color, Assets.regularFont); counter++; positionCounter++; } if (selX != -1 && selY != -1) { g.rec3d(selX, selY, SIZE, SIZE, 5, AliteColors.get().selectedColoredFrameLight(), AliteColors.get().selectedColoredFrameDark()); } }
Example 13
Source File: AboutScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
@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); }
Example 14
Source File: InGameManager.java From Alite with GNU General Public License v3.0 | 4 votes |
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 15
Source File: FlightScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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 16
Source File: PlanetScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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_TEXTURE_2D); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 17
Source File: ShipIntroScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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: CougarScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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 19
Source File: ConstrictorScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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 20
Source File: ShipEditorScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
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); }