本文整理汇总了Java中android.opengl.GLES11类的典型用法代码示例。如果您正苦于以下问题:Java GLES11类的具体用法?Java GLES11怎么用?Java GLES11使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLES11类属于android.opengl包,在下文中一共展示了GLES11类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGlDetails
import android.opengl.GLES11; //导入依赖的package包/类
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();
}
示例2: performIntergalacticJump
import android.opengl.GLES11; //导入依赖的package包/类
public boolean performIntergalacticJump() {
InGameManager.safeZoneViolated = false;
if (player.getActiveMissions().size() == 0) {
player.increaseIntergalacticJumpCounter();
if (player.getIntergalacticJumpCounter() == 1) {
// Mimic Amiga behavior: Mission starts after 1 intergal hyperjump
// and 63 other jumps (intergal or intragal).
player.resetJumpCounter();
}
}
int nextGal = generator.getCurrentGalaxy() + 1;
if (nextGal > 8 || nextGal < 1) {
nextGal = 1;
}
generator.buildGalaxy(nextGal);
player.setCurrentSystem(generator.getSystem(player.getCurrentSystem().getIndex()));
player.setHyperspaceSystem(player.getCurrentSystem());
player.getCobra().removeEquipment(EquipmentStore.galacticHyperdrive);
setIntergalActive(false);
setScreen(new FlightScreen(this, false));
GLES11.glMatrixMode(GLES11.GL_TEXTURE);
GLES11.glLoadIdentity();
navigationBar.setActiveIndex(2);
return true;
}
示例3: drawText
import android.opengl.GLES11; //导入依赖的package包/类
@Override
public void drawText(String text, int x, int y, long color, GLText font) {
if (font == null) {
return;
}
float alpha = (float) ((((long) color) & (long) 0xFF000000) >> 24) / 255.0f;
float red = ((color & 0x00FF0000) >> 16) / 255.0f;
float green = ((color & 0x0000FF00) >> 8) / 255.0f;
float blue = (color & 0x000000FF) / 255.0f;
GLES11.glEnable(GLES11.GL_BLEND);
GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE);
font.begin(red, green, blue, alpha);
y -= (int) (font.getSize());
font.draw(text, transX(x), transY(y));
font.end();
GLES11.glDisable(GLES11.GL_BLEND);
textureManager.setTexture(null);
}
示例4: present
import android.opengl.GLES11; //导入依赖的package包/类
@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);
}
}
示例5: displayShip
import android.opengl.GLES11; //导入依赖的package包/类
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);
}
示例6: renderMissiles
import android.opengl.GLES11; //导入依赖的package包/类
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();
}
}
}
示例7: initializeGl
import android.opengl.GLES11; //导入依赖的package包/类
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);
}
示例8: drawDashedCircle
import android.opengl.GLES11; //导入依赖的package包/类
@Override
public void drawDashedCircle(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_LINES, 0, segments);
}
示例9: drawCircle
import android.opengl.GLES11; //导入依赖的package包/类
@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);
}
示例10: fillRect
import android.opengl.GLES11; //导入依赖的package包/类
@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);
}
示例11: Disk
import android.opengl.GLES11; //导入依赖的package包/类
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;
}
示例12: init
import android.opengl.GLES11; //导入依赖的package包/类
@Override
protected void init() {
GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_AMBIENT, lightAmbient, 0);
GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_DIFFUSE, lightAmbient, 0);
GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_SPECULAR, lightSpecular, 0);
GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_POSITION, lightPosition, 0);
GLES11.glLightf(GLES11.GL_LIGHT3, GLES11.GL_SPOT_CUTOFF, 35.0f);
GLES11.glLightf(GLES11.GL_LIGHT3, GLES11.GL_SPOT_EXPONENT, 100.0f);
vertexBuffer = createFaces(VERTEX_DATA, NORMAL_DATA,
1, 0, 8, 2, 0, 1, 3, 1, 9, 4, 2, 1, 4, 1, 3,
4, 7, 6, 5, 0, 2, 5, 2, 6, 6, 2, 4, 7, 5, 6,
8, 0, 11, 8, 11, 5, 8, 5, 7, 8, 7, 4, 8, 4, 3,
8, 3, 10, 9, 1, 8, 9, 8, 10, 9, 10, 3, 11, 0, 5);
texCoordBuffer = GlUtils.toFloatBufferPositionZero(TEXTURE_COORDINATE_DATA);
alite.getTextureManager().addTexture(textureFilename);
if (Settings.engineExhaust) {
addExhaust(new EngineExhaust(this, 13, 13, 300, -50, 0, 0));
addExhaust(new EngineExhaust(this, 13, 13, 300, 50, 0, 0));
addExhaust(new EngineExhaust(this, 5, 5, 180, -115, 0, 0, 1.0f, 0.5f, 0.0f, 0.7f));
addExhaust(new EngineExhaust(this, 5, 5, 180, 115, 0, 0, 1.0f, 0.5f, 0.0f, 0.7f));
}
initTargetBox();
}
示例13: setTexture
import android.opengl.GLES11; //导入依赖的package包/类
public void setTexture(String fileName) {
if (fileName == null) {
GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, 0);
return;
}
Texture texture = textures.get(fileName);
if (texture == null || !texture.isValid()) {
addTexture(fileName);
texture = textures.get(fileName);
}
if (texture != null) {
if (!texture.isValid()) {
texture.index[0] = addTexture(fileName);
}
if (texture.index[0] != 0) {
GLES11.glBindTexture(GLES11.GL_TEXTURE_2D, texture.index[0]);
}
}
}
示例14: freeAllTextures
import android.opengl.GLES11; //导入依赖的package包/类
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();
}
示例15: fillCircle
import android.opengl.GLES11; //导入依赖的package包/类
@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);
}