Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the aspect ratio of an OpenGL texture affect performance?

If I wanted a sprite sheet with 100 10*10pixel sprites, would it be ok to just have them all in a row to make a 1,000*10pixel texture? Or do GPUs do better with textures that are not so narrow? Does it make any difference at all, regarding performance?

like image 276
Duovarious Avatar asked Nov 18 '25 00:11

Duovarious


1 Answers

While modern graphics devices support it easily, older ones have a problem with non-power of two textures.

If you want to support older devices you should use texture dimensions that are a power of two in both height and width, even if that means wasting a few pixels.

I think I also read somewhere, that even modern graphics devices perform better with power of two textures. But I can't give any reference to this claim.

A texture does not have to be square to be handled well by the GPU. You just have to look out that you don't exceed the maximum height and width the GPU supports. But if you stay below 4096 pixels in height and width you are pretty safe.

like image 91
Nitram Avatar answered Nov 19 '25 14:11

Nitram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!