안드로이드(Android) 2.0 NDK 미리 보기 - OpenGL ES 2.0 지원
오늘 안드로이드 2.0 소스가 공개되자마자 NDK 부터 살펴봅니다. 지난 달에 2.0 SDK 는 이미 공개되었지만, NDK는 아직 나오지 않았습니다. 지난 버전(1.6)은 SDK 출시 이후 두 주 만에 NDK가 출시된 전력이 있습니다. 아직 정식 출시되지는 않았습니다만 eclair 브랜치에 들어있는 2.0 NDK 의 바뀐 내용들을 살펴봅니다.
- 예전에 포스트로 알려드린 설치스크립트 host-setup.h 의 문제가 해결된 것으로 보이고
- 당연히 android-5 가 추가되고
- 공유 라이브러리 호환성을 개선했고
- OpenGL ES 2.0을 지원하고 데모로 hello-gl2 을 추가했습니다.
- C 라이브러리 헤더들을 개선했습니다. 전에 알려드린 wchar_t 과 localeconv() 문제는 그대로 입니다.
이중 가장 눈에 띄는 변화는 역시 OpenGL ES 2.0 입니다. Java 로는 2.0 을 쓰실 수 없습니다. 오직 NDK로만 가능합니다. Binder 프로토콜은 그대로입니다. 때문에 제 Binder 강의는 2.0에도 그대로 적용됩니다. 몇 가지 추가된 시스템 서비스에 대해서는 주석을 붙여두었습니다. 관련 포스트:
- 안드로이드(Android) 2.0 소스가 공개되었습니다
- 안드로이드(Android) NDK는 wchar_t을 지원하지 않습니다
- 안드로이드(Android) 1.6 NDK 의 리눅스(Linux) 설치 스크립트 오류
- 안드로이드 바인더(Android Binder)
CHANGES.TXT
IMPORTANT BUG FIXES:
- Fix build/host-setup.sh to execute as a Bourne shell script (again)
- Make target shared libraries portable to systems that don't use the exact same
toolchain (GCC 4.2.1) .
- Actually use the awk version detected by host-setup.sh during the build.
IMPORTANT CHANGES:
- Added platform eclair-5 to reflect the Eclair branch. This is merely a copy
of android-4 that also includes headers and libraries for OpenGL ES 2.0.
See the sample named "hello-gl2" for a *very* basic demonstration. Note that
OpenGL ES 2.0 is currently *not* available from Java, and must be used through
native code exclusively.
OTHER FIXES & CHANGES:
- Added --prebuilt-ndk=FILE option to build/tools/make-release.sh script to
package a new experimental NDK package archive from the current source tree
plus the toolchain binaries of an existing NDK release package. E.g.:
build/tools/make-release.sh
--prebuilt-ndk=/path/to/android-ndk-1.6_r1-linux-x86.zip
will generate a new NDK package in /tmp/ndk-release that contains the most
up-to-date build scripts, plus the toolchain binaries from 1.6_r1 (which
are not in the git repository).
Also added the --no-git option to collect all sources from the current
NDK root directory, instead of the list given by 'git ls-files'. This can
be useful if you don't want to checkout the whole 'platform/development'
project from repo and still work on the NDK.
This change is to help people easily package experimental NDK releases to
test and distribute fixes and improvements.
- Remove bash-isms from build/tools/build-toolchain.sh. Now it's possible to
build it with the 'dash' shell on Debian-based systems (tested on Ubuntu 8.04)
- Remove bash-ism from build/tools/build-ndk-sysroot.sh
- Refresh C library headers for all platforms:
- make simply include
- make properly declare 64-bit integer types with a C99 compiler
- add missing to
- add GLibc-compatible macro aliases (st_atimensec, st_mtimensec and
st_ctimensec) to
- add missing declaration for tzset() in
STABLE-APIS.TXT
IV. Android-5 Stable Native APIs:
----------------------------------
All the APIs listed below are available for developing native code that runs
on the Eclair experimental branch, which will be used to make the next official
platform system images.
The OpenGL ES 2.0 Library:
--------------------------
The standard OpenGL ES 2.0 headers and contain the
declarations needed to perform OpenGL ES 2.0 rendering calls from native code.
This includes the ability to define and use vertex and fragment shaders using the
GLSL language.
If you use them, your native module should link to /system/lib/libGLESv2.so
as in:
LOCAL_LDLIBS := -lGLESv2.so
Please note that, at the moment, native headers and libraries for the EGL APIs
are *not* available. EGL is used to perform surface creation and flipping
(instead of rendering). The corresponding operations must be performed in your
VM application instead, for example with a GLSurfaceView, as described here:
http://android-developers.blogspot.com/2009/04/introducing-glsurfaceview.html
The "hello-gl2" sample application demonstrate this. It is used to draw a very
simple triangle with the help of a vertex and fragment shaders.