简体   繁体   中英

Android tablet with little endian wrong color format

I'm writing gles2 application, which works fine on every device except Galaxy Notes. Colors seems to be not RGBA, but some kind of ABGR (more like ABGA) 蓝色按钮绘制为黄色,黑色标题为红色

blue buttons drawn yellow, black titles are red (sorry for posting photo, but screenshot are showing right colors, which is odd)

I'm using offscreen buffer to draw everything on it and then draw this buffer's image on screen.

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0)

this is how i use texImage2d for textures.

I've written some test app and what shows screenshot: 在此处输入图片说明

and this is how it looks in real life 在此处输入图片说明

Check this answer .

In particular, it seems you lose endianess if you use GL_UNSIGNED_BYTE . If what you're doing is store 4 bytes in an int, then you should use GL_UNSIGNED_INT_8_8_8_8 instead. Then it will know in which order to expect them for that platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM