views:

22

answers:

0

I'm loading a bitmap into OpenGL on Android with texImage2D. The problem is that I have to create a new bitmap, and paint the old bitmap into the new one, before I load it. See the example to get a better feel for what i mean.

Generating the bitmap in this way doesn't work:

        Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),
            Calc.Init.R.drawable.testpicture);

Generating the bitmap in this way works:

        Bitmap tmp = BitmapFactory.decodeResource(context.getResources(),
          Calc.Init.R.drawable.testpicture);
        Bitmap bitmap = Bitmap.createBitmap(1024, 1024, bitmap.Config.ARGB_8888);
        Canvas c = new Canvas(bitmap);
        c.drawColor(Color.argb(0,0,0,0));
        c.drawBitmap(bitmap2,0,0,new Paint());

I guess I should specify some special format when loading from my resources, but what and how?