animate 2d image?
animate 2d image?
how to animate 2d image in irrlicht? i doesn't mean an already animated gif image, but something like this:
after clipped each part of the image (let's say 4 parts), how to animate them?
after clipped each part of the image (let's say 4 parts), how to animate them?
Last edited by Virion on Fri Oct 05, 2007 11:41 am, edited 1 time in total.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Look at that 2D sample. There you can see how to animate pictures.
In simple, you have to change the image which has to be drawn.
1. picture 1
2. 0.5 seconds later picture 2
3. 0.5 seconds later picture 3
4. 0.5 seconds later picture 4
1. picture 1
2. 0.5 seconds later picture 2
3. 0.5 seconds later picture 3
4. 0.5 seconds later picture 4
and so on.
In simple, you have to change the image which has to be drawn.
1. picture 1
2. 0.5 seconds later picture 2
3. 0.5 seconds later picture 3
4. 0.5 seconds later picture 4
1. picture 1
2. 0.5 seconds later picture 2
3. 0.5 seconds later picture 3
4. 0.5 seconds later picture 4
and so on.
Code: Select all
ITexture* spriteImage = driver->getTexture("test.bmp");
driver->makeColorKeyTexture(spriteImage,SColor(0,255,0,255));
IBillboardSceneNode* spriteObject = smgr->addBillboardSceneNode(NULL,dimension2d<float>(50,50),
vector3df(0,0,0));
spriteObject->setMaterialTexture(0,spriteImage);
spriteObject->setMaterialFlag(EMF_LIGHTING,false);
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
I've tried the animator class found in this forum as well. but what I got was a flickering white rectangle.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
OPENGL BUG!! ARGH! I changed to EDT_SOFTWARE and everything work fine o_O !!!
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
A better way would be to resize your image. Crop it to be a multiple of 2^X. It will then display correctly in Dx8, openGL etc.
multiples of 2^X are sizes like:
16
32
64
128
512
1024
2048
and so on. You can mix them to, like 64x512. I changed my game to use these sizes and it ran perfectly on all drivers
multiples of 2^X are sizes like:
16
32
64
128
512
1024
2048
and so on. You can mix them to, like 64x512. I changed my game to use these sizes and it ran perfectly on all drivers
the image is already 128x128 because I am already clear about this 2^n thingy. The pic didn't show at all!
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
I guess it doesn't find your KeyColor. Try to use the positional version and use (0,0), otherwise use the correct alpha value (presumably 255).
Next thing, you will probably want to use an alpha channel transparency with your modified texture, so set the proper material value.
And finally, calling makeColorKeyTexture requires a mipmap regeneration of the texture, so call that one before drawing the texture.
Next thing, you will probably want to use an alpha channel transparency with your modified texture, so set the proper material value.
And finally, calling makeColorKeyTexture requires a mipmap regeneration of the texture, so call that one before drawing the texture.
but even i didn't call makeColourKey it showed white as well...
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Check this, it might help.
-
- Posts: 275
- Joined: Fri May 12, 2006 6:37 pm
- Location: Germany