Page 1 of 1

Images are distorted!

Posted: Wed Jun 29, 2005 3:31 pm
by NexusInteractive
I just got the crosshair code working, but if I use a BMP with any other color than black and white, the crosshair comes out looking distorted in Irrlicht. It also does this with my logo BMP, but I took that out for now.

Anyway, I have this crosshair picture:

Image
NOTE: I converted the image to GIF becuase Phpbb wouldn't let me post a bmp image. But the actual crosshair is a BMP in the game... if that makes any difference. :P

And this is what it looks like in the game:

Image

This is the code I am using for the crosshair:

Code: Select all

(AFTER "gui::IGUIEnvironment* env = device->getGUIEnvironment();")
video::ITexture* crosshair = driver->getTexture("crosshair.bmp");
driver->makeColorKeyTexture(crosshair, core::position2d<s32>(0,0));

(AFTER "env->drawAll();")
driver->draw2DImage(crosshair, core::position2d<s32>(640/2-23,480/2-23),core::rect<s32>(0,0,23,23), 0, video::SColor(255,255,255,255), true);
But it looks fine if I use a crosshair with black and white only. Any ideas?

Posted: Wed Jun 29, 2005 3:56 pm
by don_Pedro
Make the size of image power of 2, in your case this should be 16x16 or 32x32.

Posted: Wed Jun 29, 2005 4:33 pm
by NexusInteractive
Thanks! It looks great now. :D