Sign in to follow this  

Sprite animation

This topic is 3727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've gone through the DirectXTutorial.com tutorials. Everything has gone smoothly and I understand it all except for this problem I have with sprite animation. http://www.directxtutorial.com/Tutorial9/D-GameDisplay/dx9D3.aspx Instead of reading one frame at a time, it wants to read two frames! I get this: http://i3.photobucket.com/albums/y58/CryoVenom/untitled-4.jpg Instead of: http://www.directxtutorial.com/Graphics/Tutorial9/GameDisplay/dx9D2-5.PNG I don't see why there should be any difference between what he/she gets and what I get using the exact same code. I thought maybe my direct-X had a problem using PNG but it does this with other formats too. Can anyone help me understand what is wrong here? All the code is listed on that page I provided above.

Share this post


Link to post
Share on other sites
Works fine, if you rewrote the code it's an error on your part.
Nothing to say from it without seeing Your actual code.

Only modifications i did was WS_OVERLAPPEDWINDOW and d3dpp.Windowed = true;
Since the ESC key seems a little dodgy and don't necessarily work.

Share this post


Link to post
Share on other sites
Hm, well that's no good at all...I'm using their code except windowed = TRUE.

Do you think that it's possible it's not working because of my drivers?
I am using Omega drivers for my radeon.

Share this post


Link to post
Share on other sites
You could try using beyondcompare to find the differences in your code and hers. Sometimes you just consistently overlook small differences in your code and a tutorials. I have used beyondcampare before to help me get over the same thing that is happening to you. Here is the link. The last time I used it was a about a year ago so I do not know for sure that it is still shareware. I hope that helps.

Share this post


Link to post
Share on other sites
A tip for screenshots: .jpg's are smaller in filesize, but their compression looses quality. .png's use lossless compression. In other words, your image is too low quality to properly see what's going wrong. I can't even see if it's the same image twice, but scaled, or if it's split up somehow. :)

Anyway, did you understand the concept that the tutorial explained? If so, did you try to step through the code to see how exactly it is done? Also, a single screenshot isn't representative for an animation, so how does the animation behave?

Share this post


Link to post
Share on other sites
The program is supposed to use an image of different frames of a sprite to make it seem as if it is animating. The box that it shows is supposed to start off as a line and then grow larger into a box. What I'm seeing is two different frames from the image at once.

This is the sprite sheet being used:
http://www.directxtutorial.com/Graphics/Textures/Panel3.PNG

Here you can see the frame that is in the correct image, and the two frames that show up in mine.

It's almost as if mine is using twice the width. What I don't understand is why do I have different(and strange) results when using the exact same code as the one in the tutorial. Have any of you read the code?

Maybe it's compressing the width.

Share this post


Link to post
Share on other sites
Both my laptop and desktop are pretty ancient. My laptop has a Radeon IGP 340m. My Desktop has an old walmart special. A NVIDIA Geforce FX 5500. I have the proper drivers installed for both.

Share this post


Link to post
Share on other sites
My laptop has a radeon too...

Can other people please try this and tell me what result they get and what video cards?

Also, if anyone reading this is experience with sprite animation in this manner, what would be the correct way to do this, that would work on all systems that support direct-X?

Share this post


Link to post
Share on other sites
Did you check to see if your texture is being created with the size you expect it? If you get different results on different video cards it could be because some cards cant handle textures in certain sizes. Try a small, square texture in a power of 2 size (128 by 128, 256 by 256, 512 by 512), modify the RECT moving code accordingly and see if your problem goes away.

Share this post


Link to post
Share on other sites

This topic is 3727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this