animate sprite in dx11

Started by
2 comments, last by unbird 10 years, 10 months ago

So i tried to implement sprite class but i've stuck with the animation. I just can't understand how should i create new texture which's part of source texture. And then how should i set that texture in shader? I was told that sprite code sample included in dx sdk but i can't find it...

Sorry for my poor english, im from Russia... ohmy.png

Sorry for my English.

Advertisement

So i tried to implement sprite class but i've stuck with the animation. I just can't understand how should i create new texture which's part of source texture. And then how should i set that texture in shader? I was told that sprite code sample included in dx sdk but i can't find it...

You can either create a separate texture for each animation frame, or create a single texture with all the frames in it and then render a quad with the UVs set to the right place in the texture for the frame you want.

gosh! how could i miss it... thanks

Sorry for my English.

D3D11 doesn't come with a sprite functionality out of the box anymore. You can however look at the DirectX Toolkit which has a SpriteBatch class. One of the Draw overloads supports a source rectangle parameter to select parts of a texture.

If you're not familiar with the term, this way of putting multiple images into one texture is called a sprite sheet. You can even find tools which help you generate such textures (google sprite sheet packer or something).

This topic is closed to new replies.

Advertisement