Book Image

Android NDK: Beginner's Guide

By : Sylvain Ratabouil
Book Image

Android NDK: Beginner's Guide

By: Sylvain Ratabouil

Overview of this book

Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – compiling and embedding libpng module


Let's load an OpenGL texture from a PNG file in DroidBlaster.

  1. 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 the Libraries/libpng folder.

    Create a folder named libpng inside $ANDROID_NDK/sources/. Move all files from the libpng package into this.

    Copy the file libpng/scripts/pnglibconf.h.prebuilt into the root folder libpng with other source files. Rename it as pnglibconf.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.

  2. 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...