android.opengl.GLES11 Java Examples
The following examples show how to use
android.opengl.GLES11.
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: AliteLog.java From Alite with GNU General Public License v3.0 | 6 votes |
public static String getGlDetails() { String vendor = GLES11.glGetString(GLES11.GL_VENDOR); String renderer = GLES11.glGetString(GLES11.GL_RENDERER); String version = GLES11.glGetString(GLES11.GL_VERSION); String extensions = GLES11.glGetString(GLES11.GL_EXTENSIONS); StringBuffer result = new StringBuffer(); result.append("OpenGL Vendor: " + vendor + "\n"); result.append("OpenGL Renderer: " + renderer + "\n"); result.append("OpenGL Version: " + version + "\n"); if (extensions != null) { result.append("Extensions:\n"); for (String e: extensions.split(" ")) { result.append(" " + e + "\n"); } } else { result.append("No Extensions.\n"); } return result.toString(); }
Example #2
Source File: TextureManager.java From Alite with GNU General Public License v3.0 | 6 votes |
public synchronized void freeAllTextures() { Iterator <String> iterator = Collections.synchronizedSet(textures.keySet()).iterator(); ArrayList <String> toBeRemoved = new ArrayList<String>(); while (iterator.hasNext()) { String fileName = iterator.next(); Texture texture = textures.get(fileName); if (texture != null) { GLES11.glDeleteTextures(1, texture.index, 0); texturePool.free(texture); toBeRemoved.add(fileName); } } for (String s: toBeRemoved) { textures.put(s, null); } sprites.clear(); }
Example #3
Source File: InfoGaugeRenderer.java From Alite with GNU General Public License v3.0 | 6 votes |
public void renderMissiles() { int installedMissiles = alite.getCobra().getMissiles(); GLES11.glColor4f(Settings.alpha, Settings.alpha, Settings.alpha, 0.2f * Settings.alpha); missile.justRender(); for (int i = 0; i < 4; i++) { if (i < installedMissiles) { if (i == installedMissiles - 1 && alite.getCobra().isMissileLocked()) { lockedSlot.setPosition(ct.getTextureCoordX(165 + i * 80), ct.getTextureCoordY(990), ct.getTextureCoordX(165 + i * 80 + 80), ct.getTextureCoordY(1027)); lockedSlot.justRender(); } else if (i == installedMissiles - 1 && alite.getCobra().isMissileTargetting()) { targettingSlot.setPosition(ct.getTextureCoordX(165 + i * 80), ct.getTextureCoordY(990), ct.getTextureCoordX(165 + i * 80 + 80), ct.getTextureCoordY(1027)); targettingSlot.justRender(); } else { filledSlot.setPosition(ct.getTextureCoordX(165 + i * 80), ct.getTextureCoordY(990), ct.getTextureCoordX(165 + i * 80 + 80), ct.getTextureCoordY(1027)); filledSlot.justRender(); } } else { emptySlot.setPosition(ct.getTextureCoordX(165 + i * 80), ct.getTextureCoordY(990), ct.getTextureCoordX(165 + i * 80 + 80), ct.getTextureCoordY(1027)); emptySlot.justRender(); } } }
Example #4
Source File: ControlledShipIntroScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
@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 #5
Source File: TargetBox.java From Alite with GNU General Public License v3.0 | 6 votes |
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 #6
Source File: ControlledShipIntroScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void onActivation() { AliteLog.d("Ship Intro Screen", "On Activation. glError: " + GLES11.glGetError()); Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); windowWidth = visibleArea.width(); windowHeight = visibleArea.height(); initializeGl(visibleArea); AliteLog.d("Ship Intro Screen", "On Activation. After init. glError: " + GLES11.glGetError()); AliteHud.ct = new DefaultCoordinateTransformer((Alite) game); allObjects.clear(); SpaceObject cobra = new CargoCanister((Alite) game); cobra.setPosition(0.0f, 0.0f, START_Z); inGame.getShip().setPosition(0.0f, 0.0f, 0.0f); allObjects.add(cobra); startTime = System.nanoTime(); screenStartTime = startTime; displayMode = DisplayMode.ZOOM_IN; AliteLog.d("Ship Intro Screen", "On Activation done. glError: " + GLES11.glGetError()); }
Example #7
Source File: ShipIntroScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
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 #8
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void fillRect(int x, int y, int width, int height, long color) { int x2 = transX(x + width - 1); int ty2 = transY(y + height - 1); x = transX(x); y = transY(y); int ty = y < 0 ? 0 : y; if (ty2 < 0) { return; } setGlColor(color); rectBuffer.clear(); rectBuffer.put(x); rectBuffer.put(ty); rectBuffer.put(x2); rectBuffer.put(ty); rectBuffer.put(x2); rectBuffer.put(ty2); rectBuffer.put(x); rectBuffer.put(ty2); rectBuffer.position(0); GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, rectBuffer); GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 4); }
Example #9
Source File: InGameManager.java From Alite with GNU General Public License v3.0 | 6 votes |
private void performViewTransformation(float deltaTime) { // Kudos to Quelo!! // Thanks for getting me started on OpenGL -- from simply // looking at this method, one cannot immediately grasp the // complexities of the ideas behind it. // And without Quelo, I certainly would not have understood! GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); if (!paused) { ship.applyDeltaRotation((float) Math.toDegrees(deltaYawRollPitch.z * deltaTime), (float) Math.toDegrees(deltaYawRollPitch.x * deltaTime), (float) Math.toDegrees(deltaYawRollPitch.y * deltaTime)); } ship.orthoNormalize(); Matrix.invertM(viewMatrix, 0, ship.getMatrix(), 0); GLES11.glLoadMatrixf(viewMatrix, 0); }
Example #10
Source File: InGameManager.java From Alite with GNU General Public License v3.0 | 6 votes |
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 #11
Source File: Disk.java From Alite with GNU General Public License v3.0 | 6 votes |
public Disk(final Alite alite, final float innerRadius, final float outerRadius, final float beginAngle, final float endAngle, final float beginAngleOuter, final float endAngleOuter, final int sections, final String textureFilename) { numberOfVertices = 2 * (sections + 1); this.alite = alite; this.innerRadius = innerRadius; this.outerRadius = outerRadius; this.beginAngle = beginAngle; this.endAngle = endAngle; this.beginAngleOuter = beginAngleOuter; this.endAngleOuter = endAngleOuter; this.sections = sections; vertexBuffer = GlUtils.allocateFloatBuffer(4 * 3 * numberOfVertices); texCoordBuffer = GlUtils.allocateFloatBuffer(4 * 2 * numberOfVertices); normalBuffer = GlUtils.allocateFloatBuffer(4 * 3 * numberOfVertices); allNormals = new float[3 * numberOfVertices]; plotDiskPoints(innerRadius, outerRadius, (float) Math.toRadians(beginAngle), (float) Math.toRadians(endAngle), (float) Math.toRadians(beginAngleOuter), (float) Math.toRadians(endAngleOuter), sections); this.textureFilename = textureFilename; if (textureFilename != null) { alite.getTextureManager().addTexture(textureFilename); } glDrawMode = GLES11.GL_TRIANGLE_STRIP; }
Example #12
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 #13
Source File: GLES11DrawContext.java From settlers-remake with MIT License | 6 votes |
public TextureHandle generateFontTexture(int width, int height) { TextureHandle texture = genTextureIndex(); ByteBuffer data = ByteBuffer.allocateDirect(width * height * 4); while (data.hasRemaining()) { data.put((byte) 0); } data.rewind(); bindTexture(texture); if(this instanceof GLES20DrawContext) { GLES11.glTexImage2D(GLES11.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES11.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data); } else { GLES11.glTexImage2D(GLES11.GL_TEXTURE_2D, 0, GLES11.GL_ALPHA, width, height, 0, GLES11.GL_ALPHA, GLES11.GL_UNSIGNED_BYTE, data); } setTextureParameters(); return texture; }
Example #14
Source File: Sphere.java From Alite with GNU General Public License v3.0 | 6 votes |
public void render() { if (hasNormals) { GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY); GLES11.glNormalPointer(GLES11.GL_FLOAT, 0, normalBuffer); } else { GLES11.glDisableClientState(GLES11.GL_NORMAL_ARRAY); } GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, vertexBuffer); if (textureFilename != null) { GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer); } else { GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); GLES11.glDisable(GLES11.GL_LIGHTING); GLES11.glColor4f(r, g, b, a); } alite.getTextureManager().setTexture(textureFilename); GLES11.glDrawArrays(glDrawMode, 0, numberOfVertices); if (!hasNormals) { GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY); } if (textureFilename == null) { GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } }
Example #15
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void fillCircle(int cx, int cy, int r, long color, int segments) { if (segments > 64) { segments = 64; } cx = transX(cx); cy = transY(cy); r = (int) (r * scaleFactor); circleBuffer.clear(); float step = 360.0f / segments; for (float i = 0; i < 360.0f; i += step) { float ang = (float) Math.toRadians(i); circleBuffer.put((float) (cx + Math.cos(ang) * r)); circleBuffer.put((float) (cy + Math.sin(ang) * r)); } circleBuffer.position(0); setGlColor(color); GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, circleBuffer); GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, segments); }
Example #16
Source File: TutorialScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void present(float deltaTime) { if (isGl) { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); renderGlPart(deltaTime, visibleArea); setUpForDisplay(visibleArea); } if (currentLine != null) { currentLine.prePresent(deltaTime); } doPresent(deltaTime); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glEnable(GLES11.GL_BLEND); if (!hideCloseButton) { closeButton.render(alite.getGraphics()); } GLES11.glDisable(GLES11.GL_BLEND); if (currentLine != null) { currentLine.postPresent(deltaTime); } }
Example #17
Source File: HyperspaceRenderer.java From Alite with GNU General Public License v3.0 | 6 votes |
private void init() { inGame.setPlayerControl(false); inGame.setViewport(0); inGame.getShip().setSpeed(0); inGame.getShip().getForwardVector().copy(movementVector); startTime = System.nanoTime(); Alite.get().getTextureManager().addTexture(textureFilename); cylinder = new CylinderSpaceObject(Alite.get(), "HyperspaceTunnel", 12500.0f, 100.0f, 16, false, false, textureFilename); red = 0.2f + (float) Math.random() * 0.5f; green = 0.2f + (float) Math.random() * 0.5f; blue = 0.2f + (float) Math.random() * 0.5f; SoundManager.stop(Assets.hyperspace); SoundManager.play(Assets.hyperspace); progress = 0.0f; cylinder.setMatrix(inGame.getShip().getMatrix()); cylinder.setColor(red, green, blue, 1.0f); cylinder.setSpeed(-400.0f); cylinder.moveForward(17.0f, movementVector); GLES11.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_MODULATE); movementVector.negate(); }
Example #18
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void drawCircle(int cx, int cy, int r, long color, int segments) { if (segments > 64) { segments = 64; } cx = transX(cx); cy = transY(cy); r = (int) (r * scaleFactor); circleBuffer.clear(); float step = 360.0f / segments; for (float i = 0; i < 360.0f; i += step) { float ang = (float) Math.toRadians(i); circleBuffer.put((float) (cx + Math.cos(ang) * r)); circleBuffer.put((float) (cy + Math.sin(ang) * r)); } circleBuffer.position(0); setGlColor(color); GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, circleBuffer); GLES11.glDrawArrays(GLES11.GL_LINE_LOOP, 0, segments); }
Example #19
Source File: Cougar.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void render() { 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); wing.render(); wing.applyDeltaRotation(0, 0, 180); GLES11.glMultMatrixf(wing.getMatrix(), 0); wing.render(); wing.applyDeltaRotation(0, 0, 180); alite.getTextureManager().setTexture(null); if (Settings.engineExhaust && !exhaust.isEmpty()) { for (EngineExhaust ex: exhaust) { ex.render(); } } }
Example #20
Source File: AutomaticLaunchScreen.java From Alite with GNU General Public License v3.0 | 6 votes |
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 #21
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public void drawLine(int x, int y, int x2, int y2, long color) { x = transX(x); y = transY(y); x2 = transX(x2); y2 = transY(y2); GLES11.glLineWidth(5 * scaleFactor); setGlColor(color); lineBuffer.clear(); lineBuffer.put(x); lineBuffer.put(y); lineBuffer.put(x2); lineBuffer.put(y2); lineBuffer.position(0); GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY); GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, lineBuffer); GLES11.glDrawArrays(GLES11.GL_LINES, 0, 2); GLES11.glLineWidth(1); }
Example #22
Source File: GLES11DrawContext.java From settlers-remake with MIT License | 5 votes |
protected void bindTexture(TextureHandle texture) { if (texture != lastTexture) { int id = 0; if (texture != null) { id = texture.getInternalId(); } GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, id); lastTexture = texture; } }
Example #23
Source File: PlanetSpaceObject.java From Alite with GNU General Public License v3.0 | 5 votes |
@Override public void render() { GLES11.glDisable(GLES11.GL_LIGHTING); planet.render(); GLES11.glDisable(GLES11.GL_DEPTH_TEST); GLES11.glEnable(GLES11.GL_BLEND); GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA); if (clouds != null) { clouds.render(); } GLES11.glEnable(GLES11.GL_BLEND); GLES11.glDisable(GLES11.GL_CULL_FACE); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE); GLES11.glEnable(GLES11.GL_DEPTH_TEST); atmosphere.render(); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA); if (rings != null) { rings.render(); ringShadow.render(); } GLES11.glDisable(GLES11.GL_DEPTH_TEST); GLES11.glEnable(GLES11.GL_CULL_FACE); alite.getTextureManager().setTexture(null); }
Example #24
Source File: Sprite.java From Alite with GNU General Public License v3.0 | 5 votes |
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 #25
Source File: OnScreenDebug.java From Alite with GNU General Public License v3.0 | 5 votes |
public static final void debugBuckets(Alite alite, final List <DepthBucket> sortedObjectsToDraw) { int depthBucketIndex = 1; for (DepthBucket depthBucket: sortedObjectsToDraw) { String objectsString = ""; for (AliteObject o: depthBucket.sortedObjects) { objectsString += o.getName() + ", "; } String debugString = "Bucket " + depthBucketIndex + ": " + String.format("%7.2f", depthBucket.near) + ", " + String.format("%7.2f", depthBucket.far) + ": " + objectsString; GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); alite.getFont().drawText(debugString, 200, 10 + 40 * (depthBucketIndex - 1), false, 0.8f); depthBucketIndex++; } GLES11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); }
Example #26
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 #27
Source File: GLES11DrawContext.java From settlers-remake with MIT License | 5 votes |
@Override public GeometryHandle generateGeometry(int vertices, EGeometryFormatType format, boolean writable, String name) { GeometryHandle geometry = allocateVBO(format); bindGeometry(geometry); GLES11.glBufferData(GLES11.GL_ARRAY_BUFFER, vertices*format.getBytesPerVertexSize(), null, writable ? GLES11.GL_DYNAMIC_DRAW : GLES11.GL_STATIC_DRAW); return geometry; }
Example #28
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 5 votes |
@Override public void drawRect(int x, int y, int width, int height, long color) { int x2 = transX(x + width - 1); int ty2 = transY(y + height - 1); x = transX(x); y = transY(y); int ty = y < 0 ? 0 : y; if (ty2 < 0) { return; } GLES11.glLineWidth(5 * scaleFactor); setGlColor(color); rectBuffer.clear(); rectBuffer.put(x); rectBuffer.put(ty); rectBuffer.put(x2); rectBuffer.put(ty); rectBuffer.put(x2); rectBuffer.put(ty2); rectBuffer.put(x); rectBuffer.put(ty2); rectBuffer.position(0); GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, rectBuffer); GLES11.glDrawArrays(GLES11.GL_LINE_LOOP, 0, 4); GLES11.glLineWidth(1); }
Example #29
Source File: TextureManager.java From Alite with GNU General Public License v3.0 | 5 votes |
public int addTexture(String name, Bitmap bitmap) { Texture texture = textures.get(name); if (texture != null) { freeTexture(name); } bitmaps.add(name); texture = texturePool.newObject(); texture.index[0] = 0; GLES11.glGenTextures(1, texture.index, 0); loadTexture(bitmap, texture.index[0]); textures.put(name, texture); return texture.index[0]; }
Example #30
Source File: Sprite.java From Alite with GNU General Public License v3.0 | 5 votes |
public void simpleRender() { GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, vertexBuffer); GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 0, texCoordBuffer); alite.getTextureManager().setTexture(textureFilename); GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, 4); }