Power of Two Textures in OpenGL
OpenGL 1.3 does not support NPOT textures. All the images that I'm being supplied with do not fit this specification as开发者_JAVA技巧 I'm doing 2D and drawing sprites.
Is there any precoded workaround for this?
If not, what are the best options for coding around this? Padding with transparent pixels? Splitting into sub-textures?
The best way to deal with this is to resample the texture. If you roll your own, a simple bilinear filter should be sufficient to resize to the next power of two. Otherwise, there's plenty of image filtering frameworks out there.
Splitting is not recommended if you have filtering enabled.
You can use padding if you don't need texture-wrapping. The color of the pixels you use for it, however, depends on the clamp mode for the texture and the border color, if you're using that.
精彩评论