Max Texture size on Droid/Milestone

Problems with Canvas, OpenGL, etc...

Max Texture size on Droid/Milestone

Postby serkejal » Thu Jun 24, 2010 1:08 pm

Hi,
i coding a 2d game with opengl es and i testing what i've done on my milestone (2.1).
My problem is related the texure size that the Milestone, and probably the droid, can use.
Now i created a .png of 512x512 dimension for all my textures and with GL_TEXTURE_CROP_RECT_OES crop the useful part..
but the milestone show anything :(
on my emulator the app goes good...
because i want to know the GL_MAX_TEXTURE_SIZE i write a function to convert text into bitmap for a GLSprite... on the emulator i see that the max size is 4096 but on milestone neither this appears....
can help me?
is there an "optimal size" for texture to support many device?
tanxs

PS : sorry for my english :P
serkejal
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 21, 2010 12:05 pm

Top

Re: Max Texture size on Droid/Milestone

Postby impi » Thu Jun 24, 2010 1:21 pm

go for 512x512 and you are on the save side. The G1 for example doesn't like 1024x1024 so much (or i did something wrong, but my performance crashed hard with 1024x1024 textures) but the milestone can handle 1024x1024 very well.

With 512x512 everything should be ok.
impi
Developer
Developer
 
Posts: 29
Joined: Wed Apr 28, 2010 11:17 pm

Re: Max Texture size on Droid/Milestone

Postby serkejal » Thu Jun 24, 2010 1:56 pm

probably your talk are correct...but somthing with my app goes wrong...
now also with a reduce size image (256x256) nothing appears....
...
while i posting finally found the mistake...
how is written in opengl doc texture name ar not consicutive value...
and i take a static refernece for fast testing...
nooby fault..... O.o

for the other question, are u sure that 512x512 is "optimal" for a best support??
serkejal
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 21, 2010 12:05 pm

Re: Max Texture size on Droid/Milestone

Postby impi » Thu Jun 24, 2010 7:12 pm

I'm not sure, but i work with two devices, the G1 and the Milestone and as i added an 1024x1024 texture atlas the G1 fps was around 2-3 fps and on the milestone it were the normal 60 fps. then i changed it back to an 512x512 atlas and i got my 60 fps on both devices.

So i don't know if it was related to the big texture but it seems so. Altrough the OpenGL ES spec says that at least 1024x1024 textures must be supported, so i don't know what there was going on.

So my say is that if you just go max 512x512, you are on the save side.
impi
Developer
Developer
 
Posts: 29
Joined: Wed Apr 28, 2010 11:17 pm

Re: Max Texture size on Droid/Milestone

Postby ClockworkAlchemist » Tue Jun 29, 2010 3:43 pm

I'm running in to some performance issues my self, and I'm wondering if it is texture size related. If I'm just drawing from two atlases, my render time is 3-5ms, but if I use the third my render time jumps to over 60ms. I've got a 512x512 for my background, a 1024x1024 for characters, and a 256x512 for UI. I can draw any combination of two, but as soon as I add the third my render time goes through the roof.

I should only be swapping textures three time per frame, since each
atlas sheep represents stuff that is all drawn on one layer. I can't
find any info on the rendering hardware for the G1 so I don't know if
its thrashing textures between main memory and video memory or what.
Has anybody seen anything like this?
ClockworkAlchemist
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Feb 08, 2009 3:41 am
Location: Orange County, CA

Re: Max Texture size on Droid/Milestone

Postby impi » Tue Jun 29, 2010 4:02 pm

I draw an tilemap with an 512x512 texture and a bunch of different enemies with different directions with 256x256 textures. Also some Towers and UI objects in other 256x256 and 512x512 textures.

I changed my tilemap texture to 1024x1024 and the framerate was going down hardly.

I only bound the tilemap texture once, but the other textures are bounded multiple times in random order (i dont optimized this so far)

The Milestone handled this without any impact in performance.

What i have found out is, that the if(texId != oldTexId) glBindTexture(texId); check don't give me any performance advantage on the G1. It doens't made any difference like it does on normal PC hardware. I don't know what is going on there, but can this be related to this?

Edit: i'am using the draw_texture extension for non rotating sprites, and matrix transformed vbo's for the rotating sprites.
impi
Developer
Developer
 
Posts: 29
Joined: Wed Apr 28, 2010 11:17 pm

Top

Re: Max Texture size on Droid/Milestone

Postby ClockworkAlchemist » Tue Jun 29, 2010 6:13 pm

One thing you can do is try loading the textures as 16 bit. Before loading any bitmaps or textures, try this:

Code: Select all
class TextureLoader
{
  private BitmapFactory.Options mBitmapOptions = null;
  public void load()
  {
     mBitmapOptions  = new BitmapFactory.Options();
     mBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;

     // load textures.....
  }
}


Also, I think you'll need to call "setEGLConfigChooser" when setting up your surface view, before creating your renderer or textures. I'm playing around with this right now to see what it does to my poor G1.
ClockworkAlchemist
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Feb 08, 2009 3:41 am
Location: Orange County, CA

Re: Max Texture size on Droid/Milestone

Postby impi » Tue Jun 29, 2010 10:59 pm

is ARGB_4444 supported by OpenGL ES ? Currently every object use alpha blending in my game. (The tilemap has multiple layers, wich are alpha blended too)
impi
Developer
Developer
 
Posts: 29
Joined: Wed Apr 28, 2010 11:17 pm

Top

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

Who is online

Users browsing this forum: No registered users and 8 guests