Entries from 2011-01-01 to 1 year

When you change API level on Eclipse,

You have to adjust both project property and AndroidManifest.xml.

When you want preference screen in live wallpaper,

(1) put in AndroidManifest.xml(2)put android:settingsActivity="com.foo.FooSettings" in tab in foo.xml under @xml(3)write foo_settings.xml and string.xml then put them into @xml and @value respectively.(4)write Java codes using addPreferenc…

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 …

how to import existing files as an Eclipse project

1)make sure no project is selected2)file->import->Existing Projects into Work Space3)select root directry4)check "Copy projects into workspace" (*IMPORTANT this may overwrite existing project)5)refresh 6)finish

fseek doesn't look working

void myLoadAsset(AAssetManager* mngr){ const char imageFilename[] = "myImage.png"; AAsset* asset = AAssetManager_open(mngr, imageFilename, AASSET_MODE_UNKNOWN); FILE* fp = (FILE*)AAsset_getBuffer(asset); // AAsset_seek(asset, 1000, SEEK_SE…

asset manager const void* AAsset_getBuffer(AAsset* asset);

const void* AAsset_getBuffer(AAsset* asset);Dianne Hackborn says: I suggest not using getBuffer() for a compressed file. It really only make sense for a file that isn't compressed, where this can give you a direct pointer to the mmapped da…

object types in ndk assetmanager

getBuffer returns the pointer to the mmapped image of the asset. openFileDescriptor returns the file descriptor to the mmapped image of the asset. fdopen(file descriptor) returns the pointer to the WHOLE package(.apk).