lundi 29 juin 2015

Why FreeImage loads image in BGR format?


I write game using Android NDK and FreeImage library to load images into my game. It loads images in BGR format. It is possible to load in RGB format? Or I need to swap R and B components manualy?

Edited

My device is Samsung Galaxy S4(armv7 archtecture). Here is code`

FIMEMORY* fiStream = FreeImage_OpenMemory((BYTE*)data, size);
FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(fiStream);
if (FreeImage_FIFSupportsReading(fif))
{
    dib = FreeImage_LoadFromMemory(fif, fiStream, 0);
}

if (!dib)
    return;

data_ = FreeImage_GetBits(dib);
width_ = FreeImage_GetWidth(dib);
height_ = FreeImage_GetHeight(dib);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width_, height_, 0, GL_RGB, GL_UNSIGNED_BYTE, data_ );


Aucun commentaire:

Enregistrer un commentaire