本文介绍了硬件加速的活动 - 如何让OpenGL的纹理大小限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现硬件加速的蜂窝,并显示在画布上的一些位图。一切工作正常,但对于大位图(> 2048一维),我得到的日志错误:

I'm trying to enable hw acceleration in Honeycomb, and display some Bitmaps on Canvas.All works fine, but for large bitmaps (>2048 in one dimension), I get error in log:

OpenGLRenderer:位图太大,上传到纹理

我知道这是因为硬件限制,可以工作围绕它通过降低最高位图的大小如果硬件加速启用要显示(由View.isHardwareAccelerated检查())。

I know this is because of hw limitation, and can work-around it by reducing max bitmap size to be displayed if hw acceleration is enabled (checking by View.isHardwareAccelerated()).

我的问题是:如何轻松地由硬件决定的最大纹理尺寸可供位图绘制。2048似乎是我的设备上的限制,但它可以是在不同的情况不同。

My question is: how to easily determine max texture size available for Bitmap drawing by hardware.2048 seems to be limit on my device, but it may be different on different ones.

编辑:我没有创造的OpenGL应用程序,只是正常的应用程序,它可以利用硬件加速。因此,我不熟悉OpenGL的所有,我刚才看到的OpenGL相关的错误日志,并期待解决这个问题。

I'm not creating OpenGL app, just normal app, which can utilize hw acceleration. Thus I'm not familiar with OpenGL at all, I just see OpenGL related error in log, and look to solve it.

推荐答案

目前的最低限度为2048px(即硬件的必须支持纹理至少2048×2048)。在ICS,我们将引入一个新的API在Canvas类,会给你这样的信息:
Canvas.getMaximumBitmapWidth() Canvas.getMaximumBitmapHeight()

Currently the minimum limit is 2048px (i.e. the hardware must support textures at least 2048x2048.) In ICS we will introduce a new API on the Canvas class that will give you this information:
Canvas.getMaximumBitmapWidth() and Canvas.getMaximumBitmapHeight().

这篇关于硬件加速的活动 - 如何让OpenGL的纹理大小限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:32