Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What I know: Android can load PNG, BMP, WEBP,... via BitmapFactory.

What I want to achive: Load my own 2D file format (e.g. 1-bit texture with a 1-bit alpha channel) and output a RGBA8888 texture.

Question: Is there any interface to achieve this?(or any other way)

The resulting image is used as a texture for a 3D model.

Why would you do that? Saving phone memory and download bandwidth while expanding the texture at runtime to RAM seems reasonable for very simple textures.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

You can load texture with glTexImage2D You will pass texel format and pointer to texel array texel is textures pixels

glTexImage2D(
    GL_TEXTURE_2D, 0, GL_RGBA,
    TEXTURE_WIDTH, TEXTURE_HEIGHT,
    0, GL_RGBA, GL_UNSIGNED_BYTE, textureArray);
share|improve this answer
    
Perfect, thanks –  random1337 Sep 16 '12 at 22:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.