简体   繁体   English

在android opengl ES中优化纹理

[英]Optimizing textures in android opengl ES

I am creating an android application that needs to at any time display 10-20 pictures from a database of 1000 + images. 我正在创建一个Android应用程序,该应用程序需要随时从1000多张图片的数据库中显示10-20张图片。 I am currently displaying the pictures as a simple texture in opengl. 我目前在opengl中将图片显示为简单纹理。 The current application is being slowed by the multiple calls to bindTexture(), as the 10-20 pictures being displayed are almost constantly swapped. 当前的应用程序由于对bindTexture()的多次调用而变慢,因为所显示的10-20张图片几乎不断交换。

I have tried optimizing with a texture atlas and that did not help much as the texture atlas has to be constantly reloaded as well. 我曾尝试使用纹理图集进行优化,但这并没有太大帮助,因为纹理图集也必须不断重新加载。 I do not want to resort to scaling down the images just yet. 我还不想诉诸缩小图像。 Are there any methods that could optimize the texturing? 有没有什么方法可以优化纹理?

I have the following suggestions: 我有以下建议:

  • If you are not doing so already, only update sections of the atlas using glTexSubImage2d. 如果尚未这样做,则仅使用glTexSubImage2d更新地图集的各个部分。
  • Use RGB565 data (or maybe RGBA4444 ?), which is half the size of RGBA8888. 使用RGB565数据(或者可能是RGBA4444吗?),它是RGBA8888大小的一半。

If that is still too slow: 如果那仍然太慢:

  • Limit the amount of data you update in the atlas each frame; 限制每帧地图集中更新的数据量; Eg update only 1/4 of an image that is not currently displayed. 例如,仅更新当前未显示的图像的1/4。 Ie take 4 frames to update an image, and in the fourth frame, change over the texture coordinates to this new image to display it. 即以4帧更新图像,然后在第四帧中,将纹理坐标转换为该新图像以显示它。

Hope that helps, 希望能有所帮助,

cheers, Aert. 干杯,Aert。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM