Resize 2D image/texture

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
Jake007
Posts: 16
Joined: Wed Jun 29, 2011 8:39 pm
Location: Slovenia

Resize 2D image/texture

Post by Jake007 »

Hi!

Is it possible to resize image or a texture? I tried a lot of different things, but the best outcome I got was arrayed image.

Could someone please paste me a code snippet or point me in the right direction.

Best regards,
Jake
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Resize 2D image/texture

Post by hybrid »

Depends on whether you want the image to become larger, or render it larger. The former is achieved with copyToScaling from IImage, the latter with draw2dimage using a destRect which is larger or smaller than the sourceRect.
Jake007
Posts: 16
Joined: Wed Jun 29, 2011 8:39 pm
Location: Slovenia

Re: Resize 2D image/texture

Post by Jake007 »

I wanted to render it larger. I managed to get it working. Thanks :).

Here is the code snippet if anyone will have the same problem:

Code: Select all

 driver->draw2DImage( image, rect<s32>(50, 50, 150, 150), rect<s32>( 0, 0, 500, 500), 0, 0, false);
 
And a function prototype:

Code: Select all

virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
                         const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,
                         const video::SColor * const colors=0, bool useAlphaChannelOfTexture=false) =0;
Regards,
Jake
Post Reply