HW accelerated activity - how to get OpenGL texture size limit?

Pointer Null picture Pointer Null · Sep 15, 2011 · Viewed 27.8k times · Source

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: Bitmap too large to be uploaded into a texture

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()).

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.

Edit: 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.

Answer

Romain Guy picture Romain Guy · Sep 23, 2011

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().