The basic idea for a texture atlas (or texture array or super texture) for 2-d drawing is to vary the (u,v) values to represent the different tiles.
Imagine you have a 2x2 texture atlas:
If you want to describe a textured quad for each one the u,v coordinates are:
textured quad showing tile a. SetTexture(TextureAtlas), U,V = (0, 0) to (0.5,05)
textured quad showing tile b. No more need to SetTexture. U,V = (0.5,0) to (1.0,0)
textured quad showing tile c. No more need to SetTexture. U,V = (0,0.5) to (0,1.0)
textured quad showing tile d. No more need to SetTexture. U,V = (0.5,0.5) to (1.0,1.0)
Hope this helps with the concept.
There are a few different choices for D3D9 implementation. Use Google and you should be able to find a few.
well,i think i can make a texture atlas by myself,and not let my program make it every times before it use.
But i have some problems here,if every textures have a different size,what should i do?
if i put all the texture together and it is bigger than texture max size which video-card support?what should i do?
some people said i can use pixel shader to draw different textures,how to do that?