本文整理汇总了Java中android.opengl.ETC1Util.loadTexture方法的典型用法代码示例。如果您正苦于以下问题:Java ETC1Util.loadTexture方法的具体用法?Java ETC1Util.loadTexture怎么用?Java ETC1Util.loadTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.ETC1Util
的用法示例。
在下文中一共展示了ETC1Util.loadTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void load(GL10 gl) {
int width = 128;
int height = 128;
Buffer image = createImage(width, height);
ETC1Util.ETC1Texture etc1Texture = ETC1Util.compressTexture(image, width, height, 3, 3 * width);
if (USE_STREAM_IO) {
// Test the ETC1Util APIs for reading and writing compressed textures to I/O streams.
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ETC1Util.writeTexture(etc1Texture, bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, bis);
} catch (IOException e) {
Log.w(TAG, "Could not load texture: " + e);
}
} else {
ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, etc1Texture);
}
}
示例2: loadTexture
import android.opengl.ETC1Util; //导入方法依赖的package包/类
/**
* Load a texture from filesystem and bind it to texture
*
* @param gl
* @param tex
* @param name
* @throws IOException
*/
public void loadTexture(GL10 gl, int tex, String name) throws IOException {
gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
InputStream textureStream;
if (context.getFileStreamPath(name).exists()) {
textureStream = context.openFileInput(name);
} else {
textureStream = context.getAssets().open(name);
}
ETC1Util.loadTexture(GL10.GL_TEXTURE_2D, 0, 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, textureStream);
textureStream.close();
}
示例3: loadTexture
import android.opengl.ETC1Util; //导入方法依赖的package包/类
public static int loadTexture(ETC1Util.ETC1Texture etc1Texture) {
// Note that unlike the js version, this does not cache textures. There
// was just one cache hit.
int tex = genTex();
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
ETC1Util.loadTexture(
GLES20.GL_TEXTURE_2D, 0, 0, GLES20.GL_RGB,
GLES20.GL_UNSIGNED_SHORT_5_6_5, etc1Texture);
return tex;
}
示例4: writeTextureToHardware
import android.opengl.ETC1Util; //导入方法依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
final InputStream inputStream = this.getInputStream();
ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D, 0, 0, this.mPixelFormat.getGLFormat(), this.mPixelFormat.getGLType(), inputStream);
}