2d graphics - can they be scaled ?

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
Alien

2d graphics - can they be scaled ?

Post by Alien »

ITexture* texture = driver->getTexture("../../media/irrlichtlogoalpha.tga");
env->addImage(texture,core::position2d<s32>(10,10));

Is it possible to change the size of an image using Irrlicht. That is, instead of just displaying the loaded image, you can actually stretch the image so its larger.

I noticed you could lock the texture, and get the pixels...what sort of structure would i use to get the data so i could modify it ?
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Post by CZestmyr »

I'm accessing the texture data in my new fire scene node, you can have a look at it, but basicaly you just have to do this:

Code: Select all

u8* pixels = (u8*) texture->lock();
for (u32 i = 0; i < pixelNum; i++){
    pixels[i * 4] .. //do whatever with the blue component
    pixels[i * 4 + 1] .. //green component
    pixels[i * 4 + 2] .. //red component
    //[i * 4 + 3] could be the alpha value, but I haven't tried it
}
Of course, this just works, when you have the A8R8G8B8 format, but the others should be similar.
Bugfree is not a synonym to dumbass-resistant

My irrlicht files and tutorials
My music in mp3
Alien

Post by Alien »

Cool :D Ever played old games like Unreal, and seen how the textures have ripple effects and the pixels undergo filters....this will allow for the same thing :) But as for scaling textures, this doesn't really help. Is there a way to give a texture a new array of pixels ?
Post Reply