Can somebody please explain how to create a pixel buffer to be passed to loadFromMemory()? I have a bitmap class (EasyBMP) which gives the RGB values for each pixel but I can't get the texture to render properly.
Below is the code I'm currently hacking at:
Code: Select all
BMP Image;
Image.ReadFromFile("Media/materials/textures/terrain_texture.bmp");
unsigned int *mPixelBuffer = (unsigned int *)malloc (Image.TellWidth() * Image.TellHeight());
for (int i=0; i<Image.TellWidth(); i++)
{
for (int j=0; j<Image.TellHeight(); j++)
{
mPixelBuffer[i+j] = (unsigned int)((Image(i,j)->Red << 16) | (Image(i,j)->Green << 8) | (Image(i,j)->Blue << 16) |(255 << 24));
}
}
CEGUI::Texture *txt = mguirenderer->createTexture();
txt->loadFromMemory(&mPixelBuffer, 32, 32, CEGUI::Texture::PF_RGBA);
Any help would be appreciated.