Jump to content
  • Advertisement
Sign in to follow this  

d3d10 texture arrays

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

Suppose I have a sequence of frames for a sprite animation, and I want to store them in a texture array. Then I will just increment the index, say, every 30th of a second to flip to the next frame in the animation. What is the best way to fill the texture array at load time? Right now I am just thinking: 1. Call ID3D10Device::CreateTexture2D with number of texture array elements. 2. Call ID3D10Texture2D::Map and fill each texture layer. But, I'm looking for an easier way. Is there a way to load each frame into an ID3D10Texture2D with D3DX10CreateTextureFromFile and then call a D3D10 function to copy a texture into a texture of a texture array? In short, is there a D3D10 function to copy an ID3D10Texture2D onto a texture in a texture array?

Share this post

Link to post
Share on other sites
Try ID3D10Device::CopySubresourceRegion. That should let you copy a whole frame texture into a subresource of a texture array. Refer to the docs for details.

Another option is to save the animation frames into one big, continuous texture like this:
instead of a tiled version like this:

then load the whole thing as a single 2D texture. Finally, create a shader resource view for a 2D texture array. Using parameters something like this:
Texture2DArray.ArraySize = the frame count in the big texture

This will give the best loading performance imo, since you only have to load it once, and the SRV does not create any overhead.

These are just ideas.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!