Entries from 2011-11-01 to 1 month

EGL in Android NDK

EGL is only supported after android-9, that is, OS 2.3.1 Gingerbread.

W/O Lighting

glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); consumes 64Kbytes more than glDisable(GL_LIGHTING); glDisable(GL_LIGHT0); in top RSS. The difference looks very small. :)

Loading texture in OpenGL

The order of gl-functions in loadTex is critical. typedef struct TextureInfo_ { int width; int height; int pixelSize; int colorType; // int algnType; // 0=unsigned char, 1=uint32_t void* pPix; int id; const char* fileName; } TextureInfo; v…

undocumented native window format in NDK

You can find only 3 formats in android/native_window.h. enum { WINDOW_FORMAT_RGBA_8888 = 1, WINDOW_FORMAT_RGBX_8888 = 2, WINDOW_FORMAT_RGB_565 = 4, }; But actually, it has others. When you set up the attributes like this const EGLint attri…

Android NDK: read JPG from assets and sdcard

Some parts of the code are borrowed from Independent JPEG Group and Android NDKでlibjpegをビルドして利用する(UsefullCode.net)Resulted texture will have dummy alpha components (0xff) for compatibility with PNG. static uint32_t make8888(int …