Question about "Playing 2D Animation with Irrlicht"

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
Alberto Rubinato
Posts: 7
Joined: Fri Dec 09, 2005 9:41 pm
Location: Italy

Question about "Playing 2D Animation with Irrlicht"

Post by Alberto Rubinato »

Hi,
excuse me for bad English.
I've used the class implemented in "Playing 2D Animation with Irrlicht" founded in Wiki section.

I've got some questions about it.

I place a sprite in some position on the screen. It seems that the origin of the sprite is his center bounding box. In other 2d Library or game tools, the origin of the sprite is tipically 0,0 ( relative to his 2d coordinates ). I've tried to change the member function "Load" in order to obtain this, but my best result is an origin in the botton-left corner of the box.
I've changed this piece of code in many ways:

Vertices[0] = S3DVertex(-x,-y,0, 0,0,0,SColor(255,255,255,255),0,1);
Vertices[1] = S3DVertex( x,-y,0, 0,0,0,SColor(255,255,255,255),1,1);
Vertices[2] = S3DVertex( x, y,0, 0,0,0,SColor(255,255,255,255),1,0);
Vertices[3] = S3DVertex(-x, y,0, 0,0,0,SColor(255,255,255,255),0,0);

Sincerly I don't know if thees lines in constructor class function are of interest for my question.

Ortho(0,0) = (double)2/(double)Screensize.Width;
Ortho(1,0) = 0;
Ortho(2,0) = 0;
Ortho(3,0) = 0;
Ortho(0,1) = 0;
Ortho(1,1) = (double)2/(double)Screensize.Height;
Ortho(2,1) = 0;
Ortho(3,1) = 0;
Ortho(0,2) = 0;
Ortho(1,2) = 0;
Ortho(2,2) = 1;
Ortho(3,2) = 0;
Ortho(0,3) = 0;
Ortho(1,3) = 0;
Ortho(2,3) = 0;
Ortho(3,3) = 1;

I know also that in 3D Engine is normal to work in unit, not in pixel coordiantes, but I'm using also Draw2DImage IDriver member function for other things, and it use 2d pixel coordinate. Is possible to use this metod also for the TAnimSpriteSceneNode? I'd like it, because I can add in symple way Animators and so on. I viewed the classes included in the "2dstuff.zip" at http://www.dev.your3dgames.com/site/dow ... dstuff.zip ( Irrlicht Link Section ). It use this coordinates method, but is not derived from ISceneNode, so no IAnimator. It use only Draw2DImage functions.

I've encountered a problem in TAnimSpriteSceneNode usage. If I use the standard Software driver, no texture are displayed. OpenGL works very well. Apfelbaum driver seems to apply a sort of alpha value or light so the texture colors result not correct. I don't use DirectX driver because I'm using mingw compiler and DirectX is disabled by default in standard Irrlicht dll. I'll recompile it with DirectX support in the future. I'm using Windows XP SP2 with a ATI video card for notebook. I've not tested on linux system or other graphics card.

Many thanks in advance. Your help is very appreciated.

Alberto Rubinato
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

not sure if this can help u at all but u may like to look at emil hamil's newest 2d extension:
http://www.freewebs.com/bcxgl/index.htm
If indeed u are using the magic2dLib (and not the old wiki 2d example) then this post was useless :(
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Guest

Post by Guest »

Many thanks bearSoft,
I've already seen it, but it seems to run only on MS platforms. No sources are included, so I'll not able to have it for Linux in the future.
Post Reply