Jump to content
  • Advertisement
Sign in to follow this  
devdber

animate sprite in dx11

This topic is 2177 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

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  

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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).

Edited by unbird

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!