二次幂纹理的效率有多高?
我正在使用 Ffmpeg 创建一个 OpenGL 视频播放器,并且我所有的视频都不是 2 的幂(因为它们是正常的视频分辨率)。它在我的 nvidia 卡上以良好的 fps 运行,但我发现它无法在较旧的 ATI 卡上运行,因为它们不支持非 2 的幂纹理。
我只会在 Nvidia 卡上使用它,所以我不太关心 ATI 问题,但我想知道如果纹理器是 2 的幂,我会得到多少性能提升?值得将它们填充掉吗?
另外,如果值得的话,我该如何将它们填充到最接近的较大的二的幂?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编写视频播放器时,您应该使用
glTexSubImage2D() 更新纹理内容
。此函数允许您提供任意大小的图像,这些图像将放置在目标纹理中的某个位置。因此,您可以首先通过调用glTexImage() 来初始化纹理
数据指针为NULL,然后填充数据。2 个纹理的纯功率性能增益很大程度上取决于所使用的硬件,但在极端情况下可能高达 300%。
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 ofglTexImage()
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%.