How much more efficient are power-of-two textures?

大兔子大兔子 提交于 2019-12-01 17:12:54

问题


I am creating an OpenGL video player using Ffmpeg and all my videos aren't power of 2 (as they are normal video resolutions). It runs at fine fps with my nvidia card but I've found that it won't run on older ATI cards because they don't support non-power-of-two textures.

I will only be using this on an Nvidia card so I don't really care about the ATI problem too much but I was wondering how much of a performance boost I'd get if the textuers were power-of-2? Is it worth padding them out?

Also, if it is worth it, how do I go about padding them out to the nearest larger power-of-two?


回答1:


Writing a video player you should update your texture content using glTexSubImage2D(). This function allows you to supply arbitarily sized images, that will be placed somewhere in the target texture. So you can initialize the texture first with a call of glTexImage() with the data pointer being NULL, then fill in the data.

The performance gain of pure power of 2 textures strongly depends on the hardware used, but in extreme cases it may be up to 300%.



来源:https://stackoverflow.com/questions/7245191/how-much-more-efficient-are-power-of-two-textures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!