Scaling images

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
Mercator
Posts: 16
Joined: Fri Jan 27, 2006 4:31 pm

Scaling images

Post by Mercator »

I just want to draw an image that fits the screen.
I know there is no scaling function for images, but the image would be scaled, when I use it for texturing a 3d object. So how can I create a textured plane (or a box) that fits the screen?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

This will strech a texture to fill the entire window

Code: Select all

  core::dimension2d<s32> textureSize = Texture->getSize();
  core::dimension2d<s32> screenSize = Driver->getScreenSize();

  core::rect<s32> srcRect(0, 0, textureSize.X, textureSize.Y);
  core::rect<s32> dstRect(0, 0, screenSize.X, screenSize.Y);

  Driver->draw2DImage(Texture, dstRect, srcRect);
Mercator
Posts: 16
Joined: Fri Jan 27, 2006 4:31 pm

Post by Mercator »

Great Answer! THANK YOU! It works perfect!
Post Reply