私は 3D 立方体を作成しています。すべての面に 1 つの画像を割り当てることができますが、面ごとに異なる画像を割り当てたいと考えています。参照用に NeHe ポートを使用したため、1 つの画像の機能は次のとおりです::
public static Bitmap getTextureFromBitmapResource(Context context, int resourceId)
{
Bitmap bitmap = null;
try
{
bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), yFlipMatrix, false);
} finally
{
if (bitmap != null)
{
bitmap.recycle();
}
}
}
私はレンダラーでこの関数を次のように呼び出しています::
Bitmap texture = getTextureFromBitmapResource(context, R.drawable.img1);
ただし、すべての顔に 1 つの画像しか設定できません。顔ごとに異なる画像を設定したい。画像の配列を作成してからこの関数に渡そうとしましたが、無駄でした。