In my 2D game I need textures that may be arbitrarily large, can be NPOT and nonsquare. They are only ever mapped to one kind of primitive: rectangles via GL_QUADS (the four QUAD corners are mapped to the four texture corners). Sometimes the texture matrix has been scaled before drawing.
I want my game to work everywhere, even on old/cheap videocards that only allow small and/or POT textures. What solution should I use? It should...
- Be easy to implement
- Have very good performance.
Currently I know of the following options:
Use an extension like
GL_TEXTURE_RECTANGLE_{EXT,NV,ARB}
so NPOT works on cards that don't support OGL2.0 native NPOT textures.- this doesn't solve the "big texture" problem.
- does it work on a maximal number of PCs? do videocards that support native OGL2.0 NPOT support those extensions as well?
- which of the three variants EXT/NV/ARB to use?
Implement BigTextures as a bunch of small, POT texture slices, which are them carefully drawn on several adjacent QUADs. This both provides "big textures" and NPOT but it's a bit difficult and limiting.
- Implement my NPOT textures as POT textures padded with transparency to the right and bottom. Will waste memory and make texture tiling a bit more difficult, and it doesn't solve the "big texture" problem.
- Use some premade solution.
An example of a problematic videocard is the Mobile Intel® 945GM Express Chipset which doesn't seem to support native NPOT.
Update: I ended up using the third option. The cool thing is, I was able to use glTexSubImage2D, rather than padding the texture manually. This is crazy fast. Yeah, it doesn't provide "big texture" support, but I realized my target GPUs support up to 2048x2048 which is good enough for me. Oh, and GL_TEXTURE_RECTANGLE_EXT wasn't even supported on the Mobile Intel® 945GM Express Chipset.