限制纹理大小?安卓的Open GL ES 2.0 [英] Limitation on texture size? Android Open GL ES 2.0

查看:938
本文介绍了限制纹理大小?安卓的Open GL ES 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有对纹理的大小,可以在任何Android的OpenGL ES 2.0的项目中使用任何类型的限制。据我所知,有一个巨大的纹理大小为4096x4096的有点少义,因为它是在一个小屏幕渲染。但是,如果要求在运行时许多纹理之间进行切换是什么?如果我想有一个纹理图集做多个较小的质地上载的快速单次上传来代替。请让我知道你的想法在这方面。

I would like to know if there is any kind of limitation on the texture size that can be used in any Android Opengl Es 2.0 projects. I understand that having a huge texture of size 4096x4096 is a bit meaning less as it is rendered on a small screen. But What if the requirement is to switch between many textures at run time? And If I want to have a texture atlas to do a quick single upload instead of multiple smaller texture upload. Please let me know your ideas in this regards.

另外我相信,必须有使图像,可以由一个装置进行处理的大小的限制,因为在设备上的存储器是有限的。不过,我想知道,如果它是一个基于分辨率​​还是基于大小。我的意思是,如果一个设备具有1024×1024的图像尺寸的限制,它可以处理大小为2048x2048的COM pressed质感,这将是相同的大小大约为uncom pressed 1024×1024的。

Also I am sure there has to be a limitation on the size of image that can be processed by a device, as the memory on the device is limited. But I would like to know if it is resolution based or is it size based. I mean if a device has a limitation of 1024x1024 image size can it handle a compressed texture of size 2048x2048 that would be of same size approx as uncompressed 1024x1024.

也请让我知道在一个通用的基础上通常有多少纹理大小或分辨率的正常设备的限制,运行Android 2.2及以上就可以。

Also please let me know on an general basis usually how much the limitation on texture size or resolution normal devices running android 2.2 and above would be.

也请让我知道如果处理高分辨率的图像opengles 2.0时,得到两个加载时间最佳性能及运行时间有任何的最佳做法。

Also please let me know if there are any best practices when handling high resolution images in opengles 2.0 to get best performance in both load time and also run time.

推荐答案

上有纹理尺寸硬件的限制。要手动找一找,你可以去到一个网站,如<一个href="http://www.glbenchmark.com/phonedetails.jsp?benchmark=glpro21&D=Google%20Galaxy%20Nexus&testgroup=gl">glbenchmark.com (这里显示的细节有关谷歌Galaxy Nexus的)。
要自动查找您的code中的最大尺寸,你可以使用这样的:

There is a hardware limitation on the texture sizes. To manually look them up, you can go to a site such as glbenchmark.com (Here displaying details about google galaxy nexus).
To automatically find the maximum size from your code, you can use something like:

int[] max = new int[1];
gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, max, 0); //put the maximum texture size in the array.

(对于GL10,但相同的方法存在GLES20)

(For GL10, but the same method exists for GLES20)

当它涉及到的处理的或图像中的编辑的你平时使用的Bitmap在机器人工作时。这个拥有图像的uncom pressed值,因此相关的解决方案。但是,建议您使用COM pressed纹理为您的OpenGL应用程序因为这提高了内存使用效率(请注意,您不能修改这些COM pressed纹理)。
previous链接

When it comes to the processing or editing of an image you usually use an instance of Bitmap when working in android. This holds the uncompressed values of your image and is thus resolution dependant. However, it is recommended that you use compressed textures for your openGL applications as this improves the memory-use efficiency (note that you cannot modify these compressed textures).
From the previous link:

纹理融为一体pression可以显著提高性能的   OpenGL应用程序通过减少内存的需求,使更多的   有效地利用内存带宽。 Android框架提供   为ETC1 COM pression格式作为标准功能的支持[...]

Texture compression can significantly increase the performance of your OpenGL application by reducing memory requirements and making more efficient use of memory bandwidth. The Android framework provides support for the ETC1 compression format as a standard feature [...]

您应该看一看本文其中包含许多好惯例和有关的纹理加载和使用提示。笔者明确写道:

You should take a look at this document which contains many good practices and hints about texture loading and usage. The author explicitly writes:

最佳实践:使用ETC的质感融为一体pression。

Best practice: Use ETC for texture compression.

最佳实践:确保你的几何形状和纹理分辨率   适合于他们在正在显示的大小。不要使用1K x 1K   质感的东西,是在最宽500像素在屏幕上。该   相同的几何形状。

Best practice: Make sure your geometry and texture resolutions are appropriate for the size they're displayed at. Don't use a 1k x 1k texture for something that's at most 500 pixels wide on screen. The same for geometry.

这篇关于限制纹理大小?安卓的Open GL ES 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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