开发者

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

开发者 https://www.devze.com 2023-03-31 14:35 出处:网络
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 ru

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.

开发者_Go百科

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?


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%.

0

精彩评论

暂无评论...
验证码 换一张
取 消