Monthly Archives: March 2010

Android: OpenGL ES screenshot

15th
Mar. × ’10

Here is how you can get a .png screenshot of an OpenGL image on Android:

// GL10 gl;
// int width, height;

int size = width * height;
ByteBuffer buf = ByteBuffer.allocateDirect(size * 4);
buf.order(ByteOrder.nativeOrder());
gl.glReadPixels(0, 0, width, height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buf);
int data[] = new int[size];
buf.asIntBuffer().get(data);
buf = null;
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
bitmap.setPixels(data, size-width, -width, 0, 0, width, height);
data = null;

short [...]

Posted in Uncategorized | Leave a comment

Android application backwards compatibility

11th
Mar. × ’10

Say you are an Android application developer. You have a last-generation Nexus or Droid phone, and you use for development a recent Android SDK version 2.1. Yet more than a half of your potential users have older phones with older versions of Android: 1.5 (Cupcake) or 1.6 (Donut).
You can simply ignore the not-up-to-date user base, [...]

Posted in Uncategorized | 3 Comments