Time for action – compiling and embedding libpng module
Let's load an OpenGL texture from a PNG file in DroidBlaster.
Go to the website http://www.libpng.org/pub/png/libpng.html and download the
libpng
source package (which is Version 1.6.10 in this book).Note
The original
libpng
1.6.10 archive is provided with this book in theLibraries/libpng
folder.Create a folder named
libpng
inside$ANDROID_NDK/sources/
. Move all files from thelibpng
package into this.Copy the file
libpng/scripts/pnglibconf.h.prebuilt
into the root folderlibpng
with other source files. Rename it aspnglibconf.h
.Note
The folder
$ANDROID_NDK/sources
is a special folder considered as a module folder by default. It contains reusable libraries. See Chapter 9, Porting Existing Libraries to Android, for more information.Write the
$ANDROID_NDK/sources/libpng/Android.mk
file with the content given in the following code:LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LS_C=$(subst $(1)/,,$(wildcard $(1)/*.c)) LOCAL_MODULE...