Skip to content

{ Monthly Archives } March 2010

Android: OpenGL ES screenshot

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, [...]

Android application backwards compatibility

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 [...]