I use QImage to load images, which are then used as textures in OpenGL. The problem is that the color components have a different order in QImage and OpenGL. I am currently using the GL_RGBA format in OpenGL and QImage::Format_ARGB32 in Qt. Because of this, I have to manually change the bytes for each pixel of the loaded image before creating the texture in OpenGL. Moreover, in order to correctly change the bytes, I need to know the finiteness of the machine.
Does anyone know a better solution for this? At least is there a way to make this conversion independent independent?
Thanks.
source share