Jump to content
  • Advertisement
Sign in to follow this  
Uphoreum

OpenGL OpenGL Textures: Only Power-of-Two?

This topic is 3942 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've read several tutorials and things that say that a texture must have it's dimensions be powers-of-two. I've also read several posts in here saying that most newer cards support non-power-of-two textures. I want to use OpenGL to draw sprites by drawing textured quads. Having the textures I put on those quads be restricted to power-of-two dimensions only doesn't make too much sense. Is this the normal way to do sprites in OpenGL? What's the status of cards supporting power-of-two? And does the same texture restrictions apply to Direct3D?

Share this post


Link to post
Share on other sites
Advertisement
I believe OpenGL has officially supported non-power of two textures since version 2.0 (which is a while ago now). Most likely you're looking at old tutorials.

Share this post


Link to post
Share on other sites
Quote:
Original post by Uphoreum
I want to use OpenGL to draw sprites by drawing textured quads. Having the textures I put on those quads be restricted to power-of-two dimensions only doesn't make too much sense. Is this the normal way to do sprites in OpenGL? What's the status of cards supporting power-of-two? And does the same texture restrictions apply to Direct3D?


Why doesn't it make any sense? Just because the texture is power-of-two doesn't mean that the part of the texture you are using has to be power of two. That's why you have texture coordinates. If you look around at most games you will see that they almost exclusively use power of two textures. I'm sure someone with greater knowledge about graphic card hardware than me will be able to explain to you why it is so.

Share this post


Link to post
Share on other sites
I'm not sure but it could be related to accuracy and easyness. Rasterize a POTs texture is more easy and accurate, especially when texture need to be shrunk or stretched.

Share this post


Link to post
Share on other sites
It's just one less problem to mess around with if you exclusively use powers of 2 textures.
100% compatibility on all cards. End of story.

Share this post


Link to post
Share on other sites
IIRC using (squared) POT textures make it possible to do some more optimizations. Some time ago they relaxed the square constrain. More recently also the non POT were supported through extensions. I *suppose* that today these extensions were introduced in the standard (on the OGL specifications you can get this info) but I don't really know if there are performance hits by using non POT textures...

Share this post


Link to post
Share on other sites
>> What's the status of cards supporting power-of-two?
i assume u mean non power of 2, (nvidia only ati is similar)
* all cards support ^2
* arb_texture_rect (gf1 upwards support this, though theres no mipmapping + texcoords are not normalized etc)
* non power of two (no restrictions ie use like ^2 textures, only gf6/7/8 support this)

>> And does the same texture restrictions apply to Direct3D?

yes its got nothing to do with the API but with the hardware

if possible u should use ^2 textures cause not only all hardware supports them but they are also slightly faster

Share this post


Link to post
Share on other sites
That's true, I could store multiple sprite images in one file or add padding and just use the texture coordinates. I'm used to SDL where I would just store each image in a separate file, so I didn't really think about that. Thanks, I understand it now.

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!