GL: Portable non power of 2 textures?

Started by
6 comments, last by Yann L 17 years, 7 months ago
So, there are quite a few extensions for non-power of 2 textures, and it appears that they are all supported by either NV or ATI, but usually not both. Am I overlooking one that is widely supported on all video cards? Or do I need to actually pick the best extension for both cards and just check for the correct one to use?
Advertisement
ARB_Texture_Rectangle ?
3rd generation time waster
Well, according to this Delphi database of extentions, there is ARB_texture_rectangle, EXT_texture_rectangle, and NV_texture_rectangle. Obviously, the NV is an nvidia one. But the site also only lists NV cards as supporting ARB_texture_rectangle, and the EXT_texture_rectangle only lists ATI cards.

It this information incorrect? I was told that the DB is sometimes a bit outdated. Can ARB be safely used on a wide range of ATI cards as well as the NV cards?
ARB_texture_rectangle is not widely supported by ATI yet, although it was added in the latest Catalyst drivers. Of course, it is not a real NPOT texture, since it cannot handle mipmapping, all wrapping modes, and uses non-normalized coordinates.

EXT_texture_rectangle is a little different from the ARB counterpart, in that it doesn't support GLSL bindings (ie. rectangle textures are not supported under GLSL, unless the ARB version is available).

ARB_texture_non_power_of_two is the real deal. It's currently only fully supported on newer nVidia cards, though. ATI kind of supports it, but not fully (that's why the extension is not officially advertised in GL_EXTENSION). But as long a you keep it without mipmaps, and with CLAMP_TO_EDGE wrapping, then NPOT textures are also supported on quite a large range of ATI cards (with normalized 0..1 coordinates).
Thanks!

Okay, well, I definately need to be able to use it with GLSL. So I guess the ARB_texture_non_power_of_two is my best bet.

Quote:Original post by Yann L
ARB_texture_non_power_of_two is the real deal. It's currently only fully supported on newer nVidia cards, though. ATI kind of supports it, but not fully (that's why the extension is not officially advertised in GL_EXTENSION). But as long a you keep it without mipmaps, and with CLAMP_TO_EDGE wrapping, then NPOT textures are also supported on quite a large range of ATI cards (with normalized 0..1 coordinates).


Not officially advertised in in GL_EXTENSION? Meaning there is no way to check for it? And how new are we talking about, with the newer NV cards? (I realized that the Delphi DB has the GL cards listed.)
Quote:Original post by smitty1276
Not officially advertised in in GL_EXTENSION? Meaning there is no way to check for it?

Well, NPOT textures are part of the core from OpenGL 2.0 on upwards. It is relatively safe to assume that OGL 2.0 compliant ATI cards (check GL_VERSION) will accept NPOT textures, as long as they respect the same limitations as with EXT_texture_rectangle (except for the fact that their coordinates are normalized, and that they are accessible from GLSL as normal 2D textures).
Oh, okay. And, if the card is slightly older (pre OGL 2.0) will this be implemented in software, or is the version something I need to definately make sure of before using them?
Quote:Original post by smitty1276
Oh, okay. And, if the card is slightly older (pre OGL 2.0) will this be implemented in software, or is the version something I need to definately make sure of before using them?

If they're not supported, NPOT texture creation will either fail or trigger a fallback to software rendering (implementation and version dependent).

AFAIK, ATI cards have inofficially supported these pseudo-NPOT textures for a long time, since their hardware can inherently handle NPOTs with normalized coordinates (but not with mipmaps & co). Supporting texture rectangles had in fact been a major hassle for them, because they needed to emulate the non-normalized coordinates by inserting additional multiplication opcodes into the shader. So ironically pseudo-NPOTs are probably faster on ATI hardware than EXT_texture_rectangle and friends...

But yes, you should definitely check for either OGL >= 2.0 or ARB_texture_non_power_of_two before using NPOTs. Be careful about the limitations on ATI hardware if ARB_npot is not supported, though. Enabling repeat wrapping, for example, will drop you to software rendering mode (ie. welcome to the happy land of 1 fps)...

Eventually, ARB_texture_non_power_of_two will be fully supported on ATI as well, and make texture rectangle totally obsolete (finally).

This topic is closed to new replies.

Advertisement