2的幂次幂纹理的效率高多少? [英] How much more efficient are power-of-two textures?
问题描述
我正在使用Ffmpeg创建OpenGL视频播放器,而我所有的视频都不是2的幂(因为它们是正常的视频分辨率).我的nvidia卡可以在fps上运行,但是我发现它不能在较旧的ATI卡上运行,因为它们不支持非二次幂纹理.
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.
我只会在Nvidia卡上使用它,所以我不太在意ATI问题,但是我想知道如果textuers是2的幂,我将获得多少性能提升?值得将它们填充出来吗?
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?
此外,如果值得的话,我该如何将它们填充到最接近的较大的2的幂数?
Also, if it is worth it, how do I go about padding them out to the nearest larger power-of-two?
推荐答案
编写视频播放器,您应该使用 glTexImage()
数据指针为NULL,然后填写数据.
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.
2种纹理的纯能力的性能提升在很大程度上取决于所使用的硬件,但在极端情况下,可能高达300%.
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%.
这篇关于2的幂次幂纹理的效率高多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!