Loading and Examining Bitmaps

The Bitmap class will become our best friend. We load a bitmap from a file by using the BitmapFactory singleton. As we store our images in the form of assets, let's see how we can load an image from the assets directory InputStream inputStream assetManager.open(bob.png) Bitmap bitmap The Bitmap class itself has a couple of methods that are of interest to us. First we want to get to know its width and height in pixels int width bitmap.getWidth() int height bitmap.getHeight() The next thing we...

Whats Making My OpenGL ES Rendering So Slow

That the Hero is slower than the second-generation devices is no big surprise. However, the PowerVR chip in the Droid is slightly faster than the Adreno chip in the Nexus One, so the preceding results are a little bit strange at first sight. On further inspection we can probably attribute the difference not to the GPU power but to the fact that we call many OpenGL ES methods each frame, which are costly Java Native Interface methods. This means that they actually call into C code, which costs...