I'm currently writing a game that uses 2D OpenGL output under sdl, and I'm trying to load text using SDL_ttf. However I have to pad the text with blank pixels as it appears that plain OpenGL doesn't support non-power of two textures. I've heard that there is an OpenGL extension called GL_ARB_texture_non_power_of_two
that enables non power of two textures. How many cards are incompatible with this extension as of today and how do I load it?
Any OpenGL version 2.0 or greater supports non-power-of-two textures. That means pretty much any card made after around 2005. This includes GeForce FX's and 6xxx and above. It also includes Radeon 9500's and above (though until the Radeon HD series, Radeons do not allow NPOTs to have mipmaps).
BTW, I hope that you aren't trying to put each character into a separate texture. Because that would be terrible from a performance standpoint. Put all of the characters you want to use in a single texture and pick out the ones you need. You don't even need an NPOT for that.
As for mrazza's comment about just using POTs, there's nothing to be afraid of with NPOT textures (as long as your hardware can support it). It shouldn't be something you go to as a first resort, because there may be a minor performance penalty with them, but for obvious cases where padding or rescaling would be inappropriate (render targets, etc), there's nothing to fear from using them.
In general, those questions are answered in the opengl specification.
However, the NPOT textures were integrated in OpenGL long ago enough that you need to look at an older version to even find a reference to this. In the 3.0 spec, e.g. you'll see in the L.3 appendix that the NPOT extension was integrated into the GL core starting with GL 2.0. So any implementation that supports GL 2.0 (that's pretty much all PC GPUs since end of 2004) supports the feature.
As to how to "load" it: there's nothing to do. Just pass non-power-of-two sizes to glTexImage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With