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.

It is very odd.I want to load .png file via asset manager which is provided by android sdk. AssetManager manager; /........./ BitmapFactory.decodeStream(manager.open(path));

It returns BGR format data but opengl es 2.0 uses RGB format so , Blue seems red , red seems blue, how odd.

Is there any solution for it?

I use Nvıdia Tegra 2 (Android 2.2) device for test the application along with c++ via JNI.

share|improve this question
add comment

2 Answers

You should be able to specify the pixel-format to be GL_BGR instead of GL_RGB.

For glTexImage2D this would be the format parameter.

share|improve this answer
add comment

You can use this extension: EXT_texture_format_BGRA8888. But, you need to check that your device can handle it. Galaxt Spica or Moment doesn't. Otherwise just do a conversion. In my engine, i swap BGRA to RGBA before loading into glTexImage.

share|improve this answer
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.