当前位置: 首页>>代码示例>>Java>>正文


Java ETC1Util.ETC1Texture方法代码示例

本文整理汇总了Java中android.opengl.ETC1Util.ETC1Texture方法的典型用法代码示例。如果您正苦于以下问题:Java ETC1Util.ETC1Texture方法的具体用法?Java ETC1Util.ETC1Texture怎么用?Java ETC1Util.ETC1Texture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.ETC1Util的用法示例。


在下文中一共展示了ETC1Util.ETC1Texture方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setResourceIds

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setResourceIds(int[] resourceIds) {
    ByteBuffer[] mipmapChain = new ByteBuffer[resourceIds.length];
    Resources resources = TextureManager.getInstance().getContext().getResources();
    int mip_0_width = 1, mip_0_height = 1;
    try {
        for (int i = 0, length = resourceIds.length; i < length; i++) {
            ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceIds[i]));
            mipmapChain[i] = texture.getData();
            if (i == 0) {
                mip_0_width = texture.getWidth();
                mip_0_height = texture.getHeight();
            }
        }
        setWidth(mip_0_width);
        setHeight(mip_0_height);
        setCompressionFormat(ETC1.ETC1_RGB8_OES);
    } catch (IOException e) {
        RajLog.e(e.getMessage());
        e.printStackTrace();
    }

    mByteBuffers = mipmapChain;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:24,代码来源:Etc1Texture.java

示例2: setInputStream

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setInputStream(InputStream compressedTexture, Bitmap fallbackTexture) {
    ETC1Util.ETC1Texture texture = null;

    try {
        texture = ETC1Util.createTexture(compressedTexture);
    } catch (IOException e) {
        RajLog.e("addEtc1Texture: " + e.getMessage());
    } finally {
        if (texture == null) {
            setBitmap(fallbackTexture);

            if (RajLog.isDebugEnabled())
                RajLog.d("Falling back to uncompressed texture");
        } else {
            setByteBuffer(texture.getData());
            setWidth(texture.getWidth());
            setHeight(texture.getHeight());

            if (RajLog.isDebugEnabled())
                RajLog.d("ETC1 texture load successful");
        }
    }
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:24,代码来源:Etc1Texture.java

示例3: 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);
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:22,代码来源:CompressedTextureActivity.java

示例4: addEtc1Texture

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public TextureInfo addEtc1Texture(InputStream compressedTex, Bitmap fallbackTex, TextureType textureType) {
    ETC1Util.ETC1Texture texture = null;
    TextureInfo textureInfo = null;
    try {
        texture = ETC1Util.createTexture(compressedTex);
    } catch (IOException e) {
        Log.e("addEtc1Texture", e.getMessage());
    } finally {
        if (texture == null) {
            textureInfo = addTexture(fallbackTex);
            Log.d("ETC1", "Falling back to uncompressed texture");
        } else {
            textureInfo = addEtc1Texture(texture.getData(), texture.getWidth(), texture.getHeight(), textureType);
            Log.d("ETC1", "ETC1 texture load successful");
        }
    }

    return textureInfo;
}
 
开发者ID:BitMastro,项目名称:PortalLW,代码行数:20,代码来源:TextureManager.java

示例5: setResourceIds

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setResourceIds(int[] resourceIds)
{
	ByteBuffer[] mipmapChain = new ByteBuffer[resourceIds.length];
	Resources resources = TextureManager.getInstance().getContext().getResources();
	int mip_0_width = 1, mip_0_height = 1;
	try {
		for (int i = 0, length = resourceIds.length; i < length; i++) {
			ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceIds[i]));
			mipmapChain[i] = texture.getData();
			if (i == 0) {
				mip_0_width = texture.getWidth();
				mip_0_height = texture.getHeight();
			}
		}
		setWidth(mip_0_width);
		setHeight(mip_0_height);
		setCompressionFormat(ETC1.ETC1_RGB8_OES);
	} catch (IOException e) {
		RajLog.e(e.getMessage());
		e.printStackTrace();
	}

	mByteBuffers = mipmapChain;
}
 
开发者ID:takyonxxx,项目名称:IRobot-Android,代码行数:25,代码来源:Etc1Texture.java

示例6: setInputStream

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setInputStream(InputStream compressedTexture, Bitmap fallbackTexture)
{
	ETC1Util.ETC1Texture texture = null;

	try {
		texture = ETC1Util.createTexture(compressedTexture);
	} catch (IOException e) {
		Log.e("addEtc1Texture", e.getMessage());
	} finally {
		if (texture == null) {
			setBitmap(fallbackTexture);
			Log.d("ETC1", "Falling back to uncompressed texture");
		} else {
			setByteBuffer(texture.getData());
			setWidth(texture.getWidth());
			setHeight(texture.getHeight());
			Log.d("ETC1", "ETC1 texture load successful");
		}
	}
}
 
开发者ID:takyonxxx,项目名称:IRobot-Android,代码行数:21,代码来源:Etc1Texture.java

示例7: addEtc1Texture

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public TextureInfo addEtc1Texture(InputStream compressedTex, Bitmap fallbackTex, TextureType textureType) {
	ETC1Util.ETC1Texture texture = null;
	TextureInfo textureInfo = null;
	try {
		texture = ETC1Util.createTexture(compressedTex);
	} catch (IOException e) {
		Log.e("addEtc1Texture", e.getMessage());
	} finally {
		if (texture == null) {
			textureInfo = addTexture(fallbackTex);
			Log.d("ETC1", "Falling back to uncompressed texture");
		} else {
			textureInfo = addEtc1Texture(texture.getData(), texture.getWidth(), texture.getHeight(), textureType);
			Log.d("ETC1", "ETC1 texture load successful");
		}
	}
	
	return textureInfo;
}
 
开发者ID:OpsLabJPL,项目名称:MarsImagesAndroid,代码行数:20,代码来源:TextureManager.java

示例8: loadTexture

import android.opengl.ETC1Util; //导入方法依赖的package包/类
private void loadTexture(Context context, Render.DrawGroup drawGroup) {
    if (drawGroup.texture != null) {
        int resource = TEXTURES.get(drawGroup.texture.toLowerCase());

        InputStream is = context.getResources().openRawResource(resource);
        try {
            ETC1Util.ETC1Texture tex = ETC1Util.createTexture(is);
            is.close();
            drawGroup.loadedCompressedDiffuseTexture = tex;
        } catch (IOException e) {
            Log.e("Body", "Loading texture: " + e);
        }
    } else {
        int[] color = { Color.rgb(
                (int)(drawGroup.diffuseColor[0] * 255 + 0.5),
                (int)(drawGroup.diffuseColor[1] * 255 + 0.5),
                (int)(drawGroup.diffuseColor[2] * 255 + 0.5))
        };
        Bitmap bitmap = Bitmap.createBitmap(color, 1, 1, Bitmap.Config.RGB_565);
        drawGroup.loadedDiffuseTexture = bitmap;
    }
}
 
开发者ID:frydsh,项目名称:GoogleBody,代码行数:23,代码来源:LayersLoader.java

示例9: setResourceId

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setResourceId(int resourceId) {
    mResourceId = resourceId;
    Resources resources = TextureManager.getInstance().getContext().getResources();
    try {
        ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceId));
        mByteBuffers = new ByteBuffer[]{texture.getData()};
        setWidth(texture.getWidth());
        setHeight(texture.getHeight());
        setCompressionFormat(ETC1.ETC1_RGB8_OES);
    } catch (IOException e) {
        RajLog.e(e.getMessage());
        e.printStackTrace();
    }
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:15,代码来源:Etc1Texture.java

示例10: setResourceId

import android.opengl.ETC1Util; //导入方法依赖的package包/类
public void setResourceId(int resourceId) {
	mResourceId = resourceId;
	Resources resources = TextureManager.getInstance().getContext().getResources();
	try {
		ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceId));
		mByteBuffers = new ByteBuffer[] { texture.getData() };
		setWidth(texture.getWidth());
		setHeight(texture.getHeight());
		setCompressionFormat(ETC1.ETC1_RGB8_OES);
	} catch (IOException e) {
		RajLog.e(e.getMessage());
		e.printStackTrace();
	}
}
 
开发者ID:takyonxxx,项目名称:IRobot-Android,代码行数:15,代码来源:Etc1Texture.java

示例11: 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;
}
 
开发者ID:frydsh,项目名称:GoogleBody,代码行数:12,代码来源:Textures.java


注:本文中的android.opengl.ETC1Util.ETC1Texture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。