glitch in draw2DImage

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
PhilK
Posts: 5
Joined: Mon Dec 15, 2003 1:00 pm

glitch in draw2DImage

Post by PhilK »

Hello fellows,

i think the draw2DImage method is broken.
I cannot get a texture drawn without having the texture squezed and distorted in vertical direction.

Code: Select all

m_pDriver->draw2DImage(m_pShipTexture, 
	core::position2d<s32>(0,0), 
	core::rect<s32>(core::position2d<s32>(0,0), 
	m_pShipTexture->getOriginalSize()), 
	NULL, video::SColor(255,255,255,255), false);
the screen is 600 pixel tall, the texture image 540. The total height of the drawn image is correct, but the bottom lines contain random pixel data and the texture has some distortions all over it.

Anyone run into that?

Happy coding,
Phil
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

Hi PhilK,
maybe i dont understand right ? -
in 0.4.2 the texture is loaded default with mipmap, maybe thats the problem, you can switch off with :
...
driver->setTextureCreationFlag(irr::video::ETCF_ALWAYS_16_BIT,true);
driver->setTextureCreationFlag(irr::video::ETCF_OPTIMIZED_FOR_QUALITY ,true);
driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS,false);
...
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

http://irrlicht.sourceforge.net/docu/cl ... xture.html
virtual const core::dimension2d<s32>& irr::video::ITexture::getOriginalSize ( ) [pure virtual]

Returns original size of the texture. The texture is usually scaled, if it was created with an unoptimal size. For example if the size of the texture file it was loaded from was not a power of two. This returns the size of the texture, it had before it was scaled. Can be useful when drawing 2d images on the screen, which should have the exact size of the original texture. Use ITexture::getSize() if you want to know the real size it has now stored in the system.
a screen cap is worth 0x100000 DWORDS
eax
Posts: 9
Joined: Sun Dec 14, 2003 12:49 pm
Location: Switzerland::Bern

Post by eax »

see http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=722
Niko wrote:
This is a bug, I think version 0.4.2 fixes this, try it out.
If it doesn't, you could change the resolution of your texture to a power of two size.
Visit Project|Aqua Homepage
Post Reply