2D sprite animation with DirectX 8

Started by
3 comments, last by Spoogy 19 years, 10 months ago
Hi, I know how to create quad. Texturing, translating, scaling rotating and etc. goes just fine - no probs. Now I want to make some sprite animation with the quads and few question popped to my mind. If I make a class to hold sprites should I... 1. load every frame of the sprite to its own texture interface or should I keep all frames in one big texture file? how big that file can be? I have read that 256x256 pixels is largest which can be loaded with some of the cards (voodoo example). What if my sprite has more frames than that size of texture can hold. How I handle that? 2. How do I set correct frame from the texture to the quad to render? I know I can translate vertices texture coordinates to find correct frame from texture, but how to do that exactly? 3. Do I need more than that 1 quad polygon to draw all my sprites? I mean, if I render one frame of one sprite (texture) with that polygon and then translate polygons position and render another sprite (texture) with the same polygon. Does that work? Is there another way to do sprite animation? Does anyone has examples (links to sites, working games or something). I cannot find anything about sprite animation in D3DX8 (or 9). What is "correct" way to do animation with multiple different sprites which has multiple frames, if we load them to different textures without D3DXSprite interface? I really have been searching a good example about a week now and I haven't found yet. There's lots of examples how to render one single texture and do manykind of tricks with that, but how about 3 different textures which has plenty of frames each? Animating and drawing them to different locations and so on... I'm very pleased if someone can help me out. [edited by - Spoogy on May 26, 2004 4:58:43 PM]
Advertisement
I have a Radeon 8500 and it supports a max texture size of 2048x2048.

I use one texture per sprite. Each texture contains multiple frames of animation.

I use ID3DXSprite to draw each frame. It lets you specify the rect from the texture to draw.
quote:Original post by eFoDay
I have a Radeon 8500 and it supports a max texture size of 2048x2048.

I use one texture per sprite. Each texture contains multiple frames of animation.

I use ID3DXSprite to draw each frame. It lets you specify the rect from the texture to draw.


Okey, It''s nice to hear how you store your sprites. How others store their sprites? I''ll liked to hear more opinions (to get my self confidence how to do that). Each sprite (frames) to own texture or something else?

How about that size restriction on older cards? If I have more frames than that 256x256 texture can hold. How I handle that?

When textures are put to video memory? Are they put there when loading the texture or then, when I set texture to device for drawing or when?

Using ID3DXSprite is easy and that I could do, but I want to do it without ID3DXSprite interface. Just for learning purposes.

I appreciate any help - thanks.
you can set a minimum system requirements for your game
like you must have a video card from a company that still exists
if you have a voodoo card it''s time to update

check out this post
Thanks for the link to that post, but I have read it before.

And what comes to those my questions above there. I have managed to get answer to them by my self.

I build up some test program and tested things out on different kind of computers and now I''m much much wiser.

Thanks for the help anyway. I''ll be back .

This topic is closed to new replies.

Advertisement