HVGA->WVGA problem with graphic stretching

Problems with Canvas, OpenGL, etc...

HVGA->WVGA problem with graphic stretching

Postby WendyL » Tue Jan 04, 2011 1:26 am


I have a tilt based game designed for the resolution 320x480 API 3.

When I play the game in an API 4 WVGA800 emulator the graphic is stretched and it causes the game to lag since the stretching is done in every update. Possible solutions I've been trying/thinking of:

1. Disable the stretching. I don't know why but today when I launched the game in the WVGA800 emulator the graphic wasn't stretched but was in the center (horisontally) and at the top of the screen. When I changed the Android project to API4 to mess with the <support-screens> the graphic got stretched again and I can't change it back. I tried setting the largeScreens and anyDensity to true/false but whatever I do the graphic is always stretched now, even if I change back to API 3.

2. Cache the streched images (Bitmap).. which I don't think I can be done automatically in some way. I tried using the bitman.createBitmap() with a matrix to scale all images instead with no good results. Is this a good solution if I can get it right?

3. Remake the graphics and put them in the res/drawable-hdpi folder... but then I'll have to change the code too because there are hard coded pixel values.

4. Now I even tried to rename the folder Drawable to Drawable-nodpi after reading http://developer.android.com/guide/prac ... pport.html
There are situations in which you may not want Android to automatically scale a resource. The easiest way to accomplish this is to put it in a "nodpi" resource directory:


.. still steched.

Maybe I should try it on an actual WVGA phone first and see if it lags? Or it will lag just like the emulator?

Hope I can get some advice from you guys.
Posts: 8
Joined: Sat Jul 03, 2010 2:03 am


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest