Jump to content
  • Advertisement
Sign in to follow this  
axv4745

OpenGL power of 2 texture dimensions

This topic is 4674 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 been working with graphics API's such as openGL and Direct3D for about a year now and a question has been hovering over my head for sometime that I'd like to have answered. Both API's, when dealing with textures, have this constraint that the textures dimensions must be powers of 2. I also know that direct3D has some flags that all you to overriden this behavior. My question is why don't they just always allow non-power of 2 textures? The texts that I have read never really explained this constraint and I have always just convinced myself that it has something to do with performance. Can anyone offer anymore insight into the significance of this constraint and what the consequences would be of using non-power of 2 textures? thanks,

Share this post


Link to post
Share on other sites
Advertisement
The power-of-2 constraint isn't an API constraint. As far as OGL and DX are concerned, using non-power-of-2 textures would be fine.

It's the actual hardware that has this constraint. I'm not sure of the exact technical reason why, but I would estimate this had to do with doing texture lookups on the GPU.

I'm not sure if you are aware, but most of todays hardware does support non-power-of-2 textures (I'm sure all SM3 cards do). This just isn't too popular yet cause old cards don't support it. I suppose in a while this would no longer be an issue.

Hope this helps.

Share this post


Link to post
Share on other sites
Non-power-of-2-textures isn't a feature that you can toggle on and off - rather, it is a feature that is or isn't supported by the hardware. Older hardware (pre-GeForce4 IIRC) doesn't support it, simply because it wasn't available at that point in time. It doesn't really have to do with performance - just what can and can't be done based on your hardware.

To determine if you can use non-pow-2-textures in D3D, just check the D3DCAPS9.TextureCaps member.

Edit: Whoa, beaten to it [grin]

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!