0

I am developing a game for Android using OpenGL ES, and until now I've using only the folder drawable-hdpi for the textures. My biggest textures are 1024x512. Which resolutions should I use for folders mdpi and ldpi? Or should I leave just 1 folder?

genpfault
  • 51,148
  • 11
  • 85
  • 139
WaLi
  • 93
  • 12

2 Answers2

0

http://developer.android.com/training/basics/supporting-devices/screens.html

To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:

xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75

I guess Android will scale images, but scaling is resource-consuming operation.

  • I know these values, but applying them directly result in images non power of 2, which is required for textures in OpenGL – WaLi Jul 16 '12 at 15:39
  • I guess those folders aren't the best place for OpenGL resources. Just place resources in assets folder and then scale resources at runtime. –  Jul 16 '12 at 15:40
  • Isn't that the same that leaving just the hdpi folder? – WaLi Jul 16 '12 at 15:43
0

Android's built-in density bitmap scaling solution isn't really helpful for GLES applications, and sometimes can even break things (such as the non-power-of-two bitmap scaling). For this reason (and others), libraries like libgdx have their own asset loading infrastructure.

If you want to really keep using bitmap loading from R.drawable, you should put the images in a drawable-nodpi folder instead, so that no pre-scaling is performed. Otherwise it is a good idea to put it under an assets folder.

If you want to do scaling for different screen densities (or more likely screen resolutions), you should do this in your code.

Aert
  • 1,989
  • 2
  • 15
  • 17