ITexture scaling

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
UpandComing
Posts: 5
Joined: Tue Dec 06, 2011 3:12 pm

ITexture scaling

Post by UpandComing »

I've been looking through the Irrlicht documentation but maybe I'm not looking in the right place so I figured I ask here.

Is there a simple way to scale an ITexture image the same way that an IGUIImage does. I thought that initializing an ITexture* and using the draw2DImage method would deal with everything but because the texture and the window size differ the texture ends up being tiled. The funny thing is I know I can just use an IGUIImage and not bother with routing through the documentation but it just irks me using an IGUIImage when the image would just be an un-interactive texture. I know it's silly but please enlighten me if you can. Thanks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: ITexture scaling

Post by hybrid »

You can also use draw2DImage for scaling up the texture. Just use the proper overload with source and dest rect.
_neo_cortex
Posts: 5
Joined: Thu Dec 29, 2011 9:54 pm

Re: ITexture scaling

Post by _neo_cortex »

Software-way: convert the texture to a image and resize as already known.

The Hardwa[y/re]-way:
i think you can use hw accelerated scaling by rendering the Texture on a plain to a big RenderToTargetTexture in high quality (Antialiasing, Anisotropic Filter, Trilinear Filter etc)
and then convert the RenderTargetTexture back to a IImage, cut not used pixels and save file

1. you are restricted by the GraphicsCard's maximum texture size.
2. you have to worry about, if your card does only support textures with power of 2 sizes
3. you have to worry about, if your cards does support rectangular texture size (mostly not) or only quadratic i.e. 1024x1024

if you like bigger Images, (my card can handle textures 8192 x 8192 max) = 2^13 x 2^13
you have to render parts of the original image to a rendertarget (VideoRAM) and then combine the results to one big image in RAM and save the final image again.

you have to worry about the borders of each rendered part, and the correct coords to combine them in RAM

this is relativly easy because with images you just set the camera to orthogonal projection and dont have to worry about the position of the camera

if you like to render 3d scenes you have to worry about the camera position, rotation of each part to compose a realistic image out of multiple rendered parts.

h.a.n.d.
Post Reply