Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 716
Pointer Null Avatar asked Sep 15 '11 09:09

Pointer Null


1 Answers

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

like image 171
Romain Guy Avatar answered Sep 19 '22 18:09

Romain Guy