Jump to content
  • Advertisement
Sign in to follow this  
ViperG

OpenGL Non Power of 2 Textures

This topic is 3852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just ran a few tests using my game on a computer running a geforce fx 5200. This card doesn't support non power of 2 textures afaik. I'm assuming this because under older drivers, it just showed a white space if any of my textures were non power of 2, the rest showed up and i got respectable frame rates. When I updated the drivers (which would include opengl 2.x) it supports non power of 2 with just normal texture binding, but because the video card doesn't support non power of 2 it software emulates it, which means about 4-7 fps. So if I am correct and all (and im asking you guys if this sounds right) I would like my game to be able to run at least the fx series, but hopefully at least geforce 4's at a minimum, as my game is 2D and these video cards shouldn't have too much a problem, even a Geforce 3 should get at least 40ish fps. My question is, should I just switch everything to power of 2, and waste some pixel/texture memory. Or should I use the old GL_TEXTURE_RECTANGLE_ARB (Opengl 1.1) (no mip mapping and must clamp, but i don't care about these im 2D) ?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ViperG
My question is, should I just switch everything to power of 2
It would be better. Unless you have a good reason to not do this, POW2 makes everything easier.
Sometimes, this cannot be done. For example, people doing renderings using CAD SW will happily go for 2278x1523 textures and you cannot really pretend them to understand how out of track they are (this is a personal experience).
Quote:
Original post by ViperG
waste some pixel/texture memory.
Padding textures is another 2nd choice. This has a few issues when you drop the textures togheter with shaders. Excluding those "advanced" stuff, they're more-or-less ok.
Quote:
Original post by ViperG
Or should I use the old GL_TEXTURE_RECTANGLE_ARB (Opengl 1.1) (no mip mapping and must clamp, but i don't care about these im 2D)
I don't raccomand it much. The extra texture target doesn't fit much but can be worked out. The first issue is the texture coordinate generation, which must scale the coords, thereby imply you know your texture before your geometry is generated (something that may require care) and that changing texture dimensions will give you nuts.
Also, take special care when simulating REPEAT properly and be prepared to have many headaches when you drop in shaders!
My personal experience with RECTANGLE is that, besides rendertargets, they're not really going to blend. I suggest to leave this out for other usage types.

Share this post


Link to post
Share on other sites
You could try to create near-optimal texture atlases in power of two textures, thus both minimizing the memory usage used by textures and furthermore decrease state changes (less texture object changes), which should yield better performance.
The texture atlases can be organized automatically (several algorithms exist for this purpose), so you will not have to perform that somewhat dreaded task yourself every time you modify, add or remove textures. Of course, the algorithm has to take locations (maps/regions) within the game into account, so only textures used (almost) simultaneously will be packed together, thus saving both texture memory and state changes.

Share this post


Link to post
Share on other sites
True, besides better memory usage, they have rougthly the same issues as padding - so no wrapping/texture lookup rerouting and minor color leaking. They're worth a look, but using native NPOT is still a 1st choice.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!