0

For OpenGL rendering, the texure sizes have to be a multiple of two. Why is there this restriction? Is it related to the memory usage, or the way the GPU processes textures?

Why do textures have to be sized a multiple of two?

Anubian Noob
  • 13,426
  • 6
  • 53
  • 75
  • Oh yup, sorry. I'll vote to close. – Anubian Noob Jun 10 '14 at 15:08
  • although http://stackoverflow.com/a/13461824/502381 says that the restriction has been lifted 10 years ago. – JJJ Jun 10 '14 at 15:08
  • Hmm ok, I'm using an early version, that's probably why. – Anubian Noob Jun 10 '14 at 15:10
  • 2
    There exists no such restriction. In OpenGL 2.0, support for non-power-of-two textures became mandatory. This did not stop many vendors from claiming GL 2.0 support when they could not implement this feature, sadly. But these days if a vendor claims compliance with a certain version they are generally much more honest about it. – Andon M. Coleman Jun 10 '14 at 15:11

1 Answers1

1

The memory used for texture in the memory banks are optimally powers of two (even more constrained than multiple of two) in order to allow best partitioning and fastest possible DMA transfers.

meandbug
  • 202
  • 2
  • 5
  • Do you have a source for this? – Anubian Noob Jun 10 '14 at 15:09
  • E.g. here http://gamedev.stackexchange.com/questions/26187/why-are-textures-always-square-powers-of-two-what-if-they-arent also the "real-time rendering" book (http://www.realtimerendering.com/) writes something about it. (I don't have it here right now. Will look later.) – meandbug Jun 10 '14 at 15:11
  • Note that the restriction for power-of-2 textures no longer exists in modern OpenGL. – datenwolf Jun 10 '14 at 15:25
  • Sure the restriction no longer exists. But it is still a way of allowing an optimal partitioning of your memory and faster memory transfers (due to alignment). – meandbug Jun 10 '14 at 15:27
  • 2
    I would be interested in seeing benchmarks on a modern GPU that show POT textures being faster than NPOT textures. All I see in the linked thread are theories and claims, and not any measurements. – Reto Koradi Jun 10 '14 at 15:59