OpenGL Textures是否比Android Bitmaps更有效地利用内存? [英] Are OpenGL Textures more memory efficient than Android Bitmaps?

查看:98
本文介绍了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.

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

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

推荐答案

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

这篇关于OpenGL Textures是否比Android Bitmaps更有效地利用内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆