Home > Blockchain >  Android Image scaling despite being located in HDPI folder (OpenGL error/warning)
Android Image scaling despite being located in HDPI folder (OpenGL error/warning)

Time:09-01

I am working on a TV app (where presumably the size limit is 2048x2048) and i'm having an issue where my image (1920 x 1080) is scaling to different sizes (thus breaking the limit of the OpenGL renderer). When I initially ran the app when the image was located in the base "drawable" folder I'd get this warning:

W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3840x2160, max=2048x2048)

...and it had doubled the images size. So, after some reading up I read that drawable-mdpi was the base (1x) folder, however i'd get the same error with no change of size. I then tried the drawable-hdpi folder and got the error again but with a change of image size:

W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2560x1440, max=2048x2048)

At this point i'm not certain how to keep the image at it's normal (1920 x 1080) size to prevent the image from not rendering; getting the OpenGL renderer error.

I think the reason for it, is something to do with where the image is located in the Android Studio scaling directories(i.e drawable, drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi and drawable-xxxhdpi). However, if i'm wrong I'd really like to know why this is occuring (for future usages) and how I can fix it

CodePudding user response:

If you want this bitmap to be outside of the normal density conversion system, use res/drawable-anydpi/.

  • Related