List of usage examples for android.opengl ETC1Util createTexture
public static ETC1Texture createTexture(InputStream input) throws IOException
From source file:com.google.android.apps.body.LayersLoader.java
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 {/*from w w w .j a va2s .c o m*/ 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; } }