Skip to main content
gamedev.net
🔒 Locked

Textures

Started by smittix Apr 13, 2005 at 3:44 AM 0 replies 350+ views
Original Post
smittix
smittix
I read that DirectX uses textures with sizes to the power of 2 (64x64, 128x128, 256x256) more efficiently than it does with textures of other sizes. I was wondering how much faster they run and if it would be worth it to change all the textures I am using from the sizes they are (ex. 200x40, 300x60) to sizes of the power of 2. -Chris
Evil Steve
Evil Steve
If your card supports non-power of 2 textures (check the caps for D3DPTEXTURECAPS_NONPOW2CONDITIONAL and D3DPTEXTURECAPS_POW2), then there shouldn't be any performace problem. However, most cards just create a texture that's a power of 2, that's the smallest possible size to fit your texture.
If your card doesn't support non-power of 2 textures, and you use D3DX to load/create your texture, then it will create a texture that's the smallest possible size to fit your texture.
In your example, if your card supports non-square textures (which quite a lot do I believe), then your 200x40 texture would be created as 256x64, and your 300x60 texture would be created as 512x64. If your card needs square textures (as older cards do), you'll end up with a 256x256 or 512x512 texture. And if your card is really old, it'll not support textures over 256x256 (My old Voodoo 2 had this limit) and fail on your second example.

So, it's not really a performance problem in terms of speed, it's in terms of memory usage.
If at all possible, stick to power-of-2 textures, and stick several textures onto one surface (E.g. your 200x40 and 300x60 could both fit on a 512x128 texture, one above the other, then you just need to get the texture coordinates correct).

Topic Locked

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

Sign in to reply to this topic.