How to catch error 'Bitmap too large to be uploaded into a texture'

后端 未结 2 1691
感动是毒
感动是毒 2021-01-12 17:07

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

相关标签:
2条回答
  • 2021-01-12 17:35

    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.

    0 讨论(0)
  • 2021-01-12 17:55

    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.

    0 讨论(0)
提交回复
热议问题