Page 1 of 1

ITexture scaling

Posted: Wed Jan 04, 2012 3:05 am
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

Re: ITexture scaling

Posted: Wed Jan 04, 2012 10:14 am
by hybrid
You can also use draw2DImage for scaling up the texture. Just use the proper overload with source and dest rect.

Re: ITexture scaling

Posted: Thu Jan 05, 2012 11:27 pm
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.