1
Graphics / Problem with colours [SOLVED]
« on: November 23, 2009, 05:25:35 am »
After loading the image with the valuable help of Laurent (you'll get in the acknoledgements right now haha) I've noticed that the colours are not correct. But I think it's sfml responsability as when I output the file in TGA I see it correctly. This is an screenshot of the problem:
And here the code responsible for showing that:
BUT, when I do this:
I get a perfect TGA image.
Any ideas? :roll:
And here the code responsible for showing that:
Code: [Select]
void ICN::showFrame( RenderWindow *Window, unsigned short nFrame, unsigned short x, unsigned short y )
{
Image Frame; // Create image instance
ostringstream outputBuffer; // Output buffer to store decoded pixels
decodePixels( outputBuffer, nFrame ); // Fill buffer with the decoded pixels of the indicated frame of ICN group of images
if( !Frame.LoadFromPixels( getFrameWidth(nFrame), getFrameHeight(nFrame), (Uint8 *)outputBuffer.str().data() ) ) // Cargamos la imagen desde el búfer de pixeles
{
fprintf( stderr, "Couldn't load pixels!" );
exit( EXIT_FAILURE );
}
Sprite Sprite( Frame ); // Create drawable sprite from image
Sprite.SetPosition( x, y ); // Place sprite in position
Window->Draw( Sprite ); // Draw sprite in window
}
BUT, when I do this:
Code: [Select]
Uint8 *pointer = (Uint8 *)outputBuffer.str().data();
fwrite( pointer, outputBuffer.str().length(), 1, outputFile );
I get a perfect TGA image.
Any ideas? :roll: