OpenGL Textures是否比Android Bitmaps更有效地利用内存?

编程入门 行业动态 更新时间:2024-10-20 01:20:33
本文介绍了OpenGL Textures是否比Android Bitmaps更有效地利用内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个自定义地图应用程序,该应用程序处理许多256x256图像(png,jpg)的位图.我当前正在使用View 2d画布,并将所有图像都导入为RGB_565.尽管我通常对应用程序的性能感到满意,但是我想添加一些功能,这些功能将需要更多的地图图块(位图).我一直在考虑使用opengl,但对它来说还很陌生.

I have a custom map application that deals with many Bitmaps that are 256x256 images (png,jpg). I'm currently using the View 2d canvas and bring in all images as RGB_565. Although I'm generally happy with the applications performance, I have features I'd like to add that will require even more map tiles (Bitmaps). I've been thinking about using opengl but am fairly new to it.

  • opengl纹理比保留位图更有效地利用内存 大约?我假设您可以将位图加载到纹理中,然后 处理位图

  • Would opengl Textures be more memory efficient than keeping Bitmaps around? I assume you can load a Bitmap into a Texture and then dispose of the Bitmap

    在opengl中可以在运行时动态加载许多不同的Textures是一种可接受的做法吗?

    Is it an acceptable practice in opengl to dynamically load many different Textures at runtime?

    您是否需要缓存Textures或GPU是否为您处理?

    Do you need to cache Textures or does the GPU handle that for you?

    更新: 我收到了很好的详细答案在GameStack上的问题.

    UPDATE: I received a nice detailed answer to this question on GameStack.

    推荐答案

  • 在应用中加载许多位图实例有时可能会导致OOM.
  • 将数据加载到纹理可以用本机代码完成.它比在应用程序中执行效率更高,只需调用memcpy即可,不需要Bitmap实例.
  • 您必须生成纹理并明确地删除它.
  • 更多推荐

    OpenGL Textures是否比Android Bitmaps更有效地利用内存?

    本文发布于:2023-11-25 22:52:23,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1631667.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:更有效地   内存   Textures   OpenGL   Bitmaps

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!