smooth DX9 sprite animation?

Started by
26 comments, last by Rattlehead 20 years, 4 months ago
Heh, thanks for the tip. I''m aware of the variety of results that DX can give. As for this particular instance, I know it works because I''ve seen it pop up, hehe... Also, I had to "edit" it a bit, the message in the actual code isn''t PG rated... LOL.

Brandon
Advertisement
sounds like you have quite a bit of fun when u code :-D
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
Always! :-D

If it ain''t fun, it ain''t worth doin''!

Brandon
quote:Original post by Rattlehead
Useless Hacker - I''ve not installed that update yet... Looks like they may have simplified things a bit.. maybe. How much of a pain is it to use a D3DXVECTOR3? I''ve yet to try one of those... How much did they change in that? Any other critical items? Thanks for the heads up!
Well, I haven''t quite sussed it yet , but it looks like the Draw function adds it to a list and then all the sprites are drawn together when you call End. However, I can''t figure out how to rotate and stretch a sprite which was easy before.
[ PGD - The Home of Pascal Game Development! ] [ Help GameDev.net fight cancer ]
Hmm... well, I guess that''s an improvement... I think it would be more efficient.

How were you stretching and rotating them before? Sprite->DrawTransform()?

Brandon
hey, rattlehead i took ur advice and switched to sprites, and well, in the mipmap thing (in D3DXCreateTextureFromFileEx()) what is a mipmap anyways? and also, should i load the texture with the same format as my device? or should i load it the way the file is formatted? (in my case its gonna be 24 bit bmp) and mip filter.... wtf? i dont know wut this mip mapping is, but anyways, any help is appreciated
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
quote:Original post by Rattlehead
How were you stretching and rotating them before? Sprite->DrawTransform()?
No, you could pass an angle to the Draw function.
[ PGD - The Home of Pascal Game Development! ] [ Help GameDev.net fight cancer ]
Hmmm... Now you're getting into territory that I've not explored yet. Talk about the blind leading the blind! LOL! At this point, I'm just loading my bmp as it is without any conversions - I think.

First, regarding the MipLevels parameter (the fourth one). I looked back at my code quoted below, and I see that I have 0 there. It might be that I should have used 1 instead. I'm really unsure, but according to the DX9 docs, a 0 there tells it to create a complete mipmap chain... whatever that is... LOL! Of course, it seems to be working fine...

Next, about the 6th param, Format... I used D3DFMT_A8R8G8B8 for that so that I could use the alpha for transparency. I don't really know that this is the best or even correct format, but, again, it's working... This is another area I need to explore further. If you look at the documentation for the D3DXCreateTextureFromFileEx() function, there's a link down in the description of this param. Scroll down to the Format parameter's description and click the link to the D3DFORMAT page in the docs. There it describes them. The format that I'm using appears to be a 24 bit format.

Finally, the MipFilter. This is the 9th param, I think. I used D3DX_DEFAULT, which according to the doc is equivalent to D3DX_FILTER_BOX. What does that mean? I don't have a clue...

But, I do think I just learned something from this foray into the docs! I could be way wrong here, but I'm getting the impression that the "new" term used for a plain old surface is a texture... It may be that one of these countless "CreateTexture" functions would be suitable for simply creating a surfact that you can draw on and manipulate?

Under the description for the 5th parameter (Usage), two of the things you can specify are D3DUSAGE_RENDERTARGET and D3DUSAGE_DYNAMIC. In the next part, it describes these using the term "surface". Perhaps this is how you create a surface here? I dunno, I just woke up, so maybe I'm still out of it, but I thought someone was looking for info on how to create a surface in D3D9... Here's the bit from the docs about that:

Setting this flag to D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can then be passed to the pNewRenderTarget parameter of the IDirect3DDevice9::SetRenderTarget method. If D3DUSAGE_RENDERTARGET is specified, the application should check that the device supports this operation by calling IDirect3D9::CheckDeviceFormat. D3DUSAGE_DYNAMIC indicates that the surface should be handled dynamically. For more information about using dynamic textures, see Using Dynamic Textures.


Unfortunately, I don't think I've really answered any of your questions here. I've mainly spouted from the docs which you've prolly already read... In short, I've not explored MipMapping yet and I'm not clear on how it is used or what it does... Maybe some kind soul will see this thread and enlighten both of us?

Useless Hacker - Ok, I see what you're talking about.... If I'd bothered to look back at the Draw() function, I'd prolly have seen that... heh.


[edited by - Rattlehead on December 5, 2003 7:48:00 AM]

This topic is closed to new replies.

Advertisement