6

My android application handles very large Bitmaps. Because of this, I turned hardware-acceleration off on the image views. However, some users have set the Developer-Option 'Force GPU-Acceleration' turned on. This leads to the error 'Bitmap too large to be uploaded into a texture'. If I check the view using isHardwareAccelerated(), it always returns false.

Is there any way to catch the OpenGL-Error 'Bitmap too large to be uploaded into a texture'?

1
  • I have the same problem. Did you find something to catch this error? Commented Apr 16, 2013 at 12:51

2 Answers 2

2

Bitmap is Composed of Pixels and you can count the number of pixels in the bitmap matrix ,, set a limit to your number of bitmap pixels . In OpenGl i can't say , but in general we can easily handle them , also there is a method
bitmap.inSampleSize();

if you assign

Bitmap.inSampleSize()= 1; 

then the original bitmap pixel will be loaded.

Bitmap.inSampleSize()= 2; 

then the pixels will become half of the original pixel.

Bitmap.inSampleSize() = 4 

then the pixels will become 1/4 of the original pixel . This way you can reduce the size of the pixels in the bitmap , I have done this thing in my program , hopefully it will work with you too.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this hint, but I need the maximum quality. Therefore, I switched Hardware-Acceleration off on this view. However, I just need to know if the user has the "Force GPU-Acceleration" enabled which leads to this error.
0

I have not worked with OpenGL on Android and therefore dont know is there is anything special one must do to catch uncaught exceptions or error. You could try to register a global exception handler and check if you are able to catch the OpenGL error there.

1 Comment

Thanks for this idea! However, since it isn't an acutal exception, this won't work. The app won't crash or anything, just the view won't draw. I just see the OpenGL-Error message in the debug/warn Log from Logcat.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.