Reputation: 3887
The problem
I have an atlast of various backgrounds which (in the HDPI folder) is 5760 x 459 in size. Originally, the file size was 1.5MB.
I've tested this on a few devices, a Nexus 10 tablet (which gets the bigger version of the file from the XHDPI folder), a generic tablet (using MDPI), a Galaxy Ace phone (MDPI Again)and everything works OK.
However, I recently got hold of a new phone running KitKat. However, it appears this handset is very low-spec. (1GB storage, 249MB RAM).
Now, when I run my app on this handset, it uses the HDPI version of the resources (as mentioned above). There are no errors, the app runs, but this particular resource simply displays as solid black.
What have I tried?
I though maybe it was a memory issue, so I used all manner of tools etc to reduce the file-size down to 182kb. However, when I ran the app, I got the same issue.
So, I copied the LDPI image into the HDPI folder (which obviously has a lower pixel count) and it ran............... it displayed OK (file size larger than 182kb).
What is going on here? The physical resolution of the phone is 900 x 540. Each individual image in the atlas is 960 x 459 so, with a bit of scaling this should fit fine as it does with other devices.
Another thing that confuses me is that my XHDPI folder contains an atlas in which each individual background is about 1/2 the width and height of the Nexus 10's screen, so this gets scaled up. However, using Google's scaling laws (Android: Supporting Multiple Screens), after scaling, each individual background image contained within the HDPI atlas is about the size of the screen of phone I'm using, so not much scaling required (whereas I would again, prefer to use images 1/2 the size of the screen).
Why is this phone not working with the current size file (physical size, not file-size) and is there any way to better manage or provide more alternate resources that just LDPI, MDPI, HDPI and XHDPI?
Upvotes: 1
Views: 506
Reputation: 54592
You are probably exceeding the maximum texture size supported by the device. The width of your texture (5760) is very large. It's common for mobile devices to have texture size limits of 4096 or even 2048 in each dimension.
You can query the texture size limit with:
GLint maxSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
Upvotes: 2
Reputation: 12526
It seems that some of the devices can load only power of 2 ( 128 x 64, 512 x 512, 1024 x 512 etc) textures. Placing images in folders like hdpi,mdpi automatically scales down the image so there is no guarantee that image are always will be power of 2. Better approach would be place the images in nodpi
folder. Or else you can put separate images in all the dp folders though but make sure that all are power of 2.
Upvotes: 0