Я делаю свои первые шаги на OpenGL-ES. Atm, я могу загрузить текстуры Power of Two (POT) на квадратный многоугольник, который я могу вращать и масштабировать на экране. Если я попытаюсь загрузить не POT PNG, то текстура будет белой.
Что мне нужно сделать, чтобы превратить не POT-текстуры в растровые изображения POT, чтобы заполнить текстуру моего квадратного многоугольника. Как я могу преобразовать их в растровые изображения POT?
Это фактический код, который я должен загрузить текстуры:
ИЗ АКТИВОВ DIR:
String imagePath = "radiocd5.png";
AssetManager mngr = context.getAssets();
// Create an input stream to read from the asset folder
InputStream is=null;
try {
is = mngr.open(imagePath);
} catch (IOException e1) { e1.printStackTrace(); }
//Get the texture from the Android resource directory
InputStream is = context.getResources().openRawResource(R.drawable.radiocd5);
Bitmap bitmap = BitmapFactory.decodeStream(is);
//Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
ОТ RES / DRAWABLE:
//Get the texture from the Android resource directory
InputStream is = context.getResources().openRawResource(R.drawable.radiocd5);
Bitmap bitmap = BitmapFactory.decodeStream(is);
//Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);