Images are distorted!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
NexusInteractive
Posts: 33
Joined: Sun Jun 26, 2005 4:41 pm

Images are distorted!

Post 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?
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post by don_Pedro »

Make the size of image power of 2, in your case this should be 16x16 or 32x32.
NexusInteractive
Posts: 33
Joined: Sun Jun 26, 2005 4:41 pm

Post by NexusInteractive »

Thanks! It looks great now. :D
Computer Specs:
AMD Duron 1.8 GHZ + 256 MB RAM + ATI Radeon 7000 Series + 20gig HDD + PCChips K7 MotherBoard
Post Reply