As far as I know cocos2dx doesn’t support BGRA picture format, so I have to use the RGBA format.
I’m trying to implement the camera picture stream as a texture.
The picture stream works fine, but because iOs supports just kCVPixelFormatType_32BGRA, I have to swap the colors red and blue.
The enum CCTexture2DPixelFormat finally affects glTexImage2D function. You can read the source in CCTexture2D.cpp line 169. Also it’s the same in cocos2d-iphone/cocos2d/CCTexture2D.m.
As the result, only OpenGL ES acceptable PixelFormats & PixelTypes can be supported in cocos2d-x.
cocos2d-iphone can works a little more because it supports PVRTexture, which contents BGRA_8888 pixel format. Since most android devices aren’t using PowerVR chipset as their opengles hardware acceleration, cocos2d-x still have no plan to support PVR texture format yet.
So currently, swapping B&R bits manually is the best approach, no matter in your application logic source or in the engine internal