Skip to main content
gamedev.net
🔒 Locked

Repeating Texture Sprites

Started by CrazyCamel 0 replies 1k views
Original Post
CrazyCamel
CrazyCamel
Is it a bad idea to take a texture, say 20x20, and draw it 100 times (10 rows by 10 columns) using ID3DXSprite::Draw() in a for loop? Would it slow down the program? Does D3D have a faster way to do it?
Grab life by the cord.
jollyjeffers
jollyjeffers
First off - it's difficult to say for sure if anything will be bad for performance without some sort of metric. What sort of hardware? is this the only thing that your application does?

Having said that, it is possible that it will hurt your performance. If it's a common/important part of your application it is likely there are better alternatives:

1. Does the tile change (e.g. animation)? If not, you could create a 200x200 texture, do a render-to-texture pass and composite all 100 copies on one larger sprite.

2. If it does animate, but each copy is still a clone of each-other then you could re-write it to be a single draw call that used texture coordinates outside of the 0.0 to 1.0 range - 0.0 to 10.0; which will cause the texture to be repeated 10x.

Bottom line though - I wouldn't worry hugely about it unless you find that performance is a problem.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.