NPOT Texture

From OpenGL Wiki
(Redirected from NPOT Textures)
Jump to navigation Jump to search
Non-Power-Of-Two Textures
Core in version 4.6
Core since version 2.0
ARB extension GL_ARB_texture_non_power_of_two

An NPOT Texture is a texture whose dimensions are not powers of 2 (Non-Power-Of-Two). In earlier hardware, there was a requirement that the dimensions of a texture were a power of two in size. NPOT textures are textures that are not restricted to powers of two.

Usage[edit]

Using this is easy; simply pass arbitrary sizes when allocating Texture Storage. These will work for any kind of Texture, from Cubemap Textures (though the width and height of these must be the same) to Array Textures.

While modern hardware no longer has the power-of-two limitation on texture dimensions, it is generally a good idea to keep using power-of-two textures unless you specifically need NPOTs. Mip-mapping with such textures can have slightly unintended consequences, compared to the power-of-two case.

Render targets are a common place where you want to have a specific, arbitrary size for your textures.

Compression[edit]

Most of the non-generic compressed texture formats are based around 4x4 blocks of pixels. While it is possible to have arbitrary sizes of these textures, you generally should keep them at a multiple of four in size. It won't lose you anything to do so.

Older hardware[edit]

The R300 and R400-based cards (Radeon 9500+ and X500+) are incapable of generic NPOT usage, despite allegedly supporting OpenGL 2.0 (which requires full support). These cards only allow you to use NPOTs if the texture has no mipmaps.

NV30-based cards (GeForce FX of any kind) are incapable of NPOTs at all, despite allegedly OpenGL 2.0 (which again requires NPOTs). It will do software rendering if you try to use it.

Any hardware beyond that can handle NPOTs of any kind perfectly.

Rectangle Textures[edit]

Rectangle textures have never had a power-of-two restriction. However, they take texture coordinates in texture space rather than normalized texture coordinates like other kinds of textures. These have their uses, but they have fallen out of favor with the advent of generic NPOT textures.