Correction: using SurfaceView to draw the background image does indeed
give me 60fps. And when adding the "sprites" on top of it, the
performance is not 60fps anymore, but still better than GLSurfaceView.


Federico


On Jan 31, 9:09 pm, Federico Carnales <fedecarna...@gmail.com> wrote:
> Did the test you requested, RGB_565, mipmapped - nearest. Got 18ms/
> frame. Better, but still unacceptable as this would only be the
> background image. The final app uses several sprites with alpha on top
> of the background, so the performance drops significantly.
>
> What's funny is that I'm getting better performance with a regular
> SurfaceView and CPU rendering. Not 60fps, but better than OpenGL's
> performance. Something is seriously wrong there.
>
> Regards,
>
> Federico
>
> On Jan 31, 7:37 pm, Robert Green <rbgrn....@gmail.com> wrote:
>
>
>
> > I'd test it on my Droid but my graphics guy has it right now.  I can
> > try it out in a week or two when I get it back from him.
>
> > I think you may be video memory bound in some form.  It sounds like
> > it's sheer bytes slowing you down.  Can you load the texture as
> > RGB_565 mipmapped - nearest and give me a number?  What about using
> > glDrawTexiOES?  I didn't realize you were trying to draw a 32 bit full
> > screen image.  I pretty much only draw 16 bit bitmaps when I can
> > unless it's an effect or control and I need the alpha for that.
>
> > On Jan 31, 12:52 pm, Federico Carnales <fedecarna...@gmail.com> wrote:
>
> > > I've created a small sample class to show the problem:
>
> > >http://fedecarnales.googlepages.com/TextureTest.java
>
> > > It simply creates a full screen GLSurfaceView, sets up an orthogonal
> > > 2D matrix, creates a 1024x1024 texture from the default icon file, and
> > > displays it as a 480x854 quad on screen. The time-per-frame is
> > > measured by counting the time it takes to render 100 frames, then
> > > dividing it by 100 and writing it to the Logcat.
>
> > > On my Motorola Milestone, it's taking 34ms per frame, which is
> > > outrageous. If I enable mipmapping it goes down to 20ms per frame,
> > > which seems to indicate that the problem is directly related to the
> > > texture size or dimensions.
>
> > > What's interesting is that if you convert the bitmap to ARGB_4444
> > > before loading it as a texture, the rendering time goes down from 34ms
> > > to 24ms, which to me seems to show that it's a problem related to the
> > > size of the texture in bytes rather than the dimensions (although the
> > > dimensions will obviously change the byte size).
>
> > > Regards,
>
> > > Federico
>
> > > On Jan 31, 2:09 pm, Robert Green <rbgrn....@gmail.com> wrote:
>
> > > > Federico - are you using GLSurfaceView or did you init EGL yourself?
> > > > If you initialized it yourself, did you check to make sure the config
> > > > gave you 24 bits of depth and not 16?  That would be one thing to
> > > > cause the slowdown.
>
> > > > I usually get 40FPS on a Droid full-screen (not with a big quad but
> > > > with a 3D scene) so something is certainly up with your code.
>
> > > > On Jan 31, 10:58 am, Lance Nanek <lna...@gmail.com> wrote:
>
> > > > > I don't have a Droid to test on, but if you haven't tried it already,
> > > > > it might be worth dropping the various texture settings down to their
> > > > > fastest/lowest quality and enabling mipmaps to check if that's where
> > > > > the problem is. Something like this:
>
> > > > > gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
>
> > > > > if ( gl instanceof GL11 ) {
> > > > >         gl.glTexParameterf(GL11.GL_TEXTURE_2D, 
> > > > > GL11.GL_GENERATE_MIPMAP,
> > > > > GL11.GL_TRUE);}
>
> > > > > gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
> > > > > GL10.GL_NEAREST);
> > > > > gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
> > > > > GL10.GL_NEAREST);
>
> > > > > Some of the past threads have also stated that depth size 24 is faster
> > > > > than anything else on the Droid for some reason. So make sure you end
> > > > > up with that config.
>
> > > > > On Jan 30, 11:58 pm, Federico Carnales <fedecarna...@gmail.com> wrote:
>
> > > > > > Hi all,
>
> > > > > > So I'm doing some simple 2D stuff with OpenGL on Android and found 
> > > > > > the
> > > > > > performance to be very, very poor.
>
> > > > > > To give you an example, I made an app with a full screen
> > > > > > GLSurfaceView. I loaded a 512x1024 texture (containing a 480x854
> > > > > > image), set up an orthogonal 2D matrix, and set it to draw a 480x854
> > > > > > pixel quad with that texture, using vertex and texture arrays.
> > > > > > Lighting, dither, blending, etc. is disabled.
>
> > > > > > I would expect this to run at 60fps without problem, but that simple
> > > > > > operation already drags the frame drawing time to 19ms/frame.
>
> > > > > > If I add some more small textured quads around the screen, the 
> > > > > > drawing
> > > > > > time goes up to 22/24ms. If I enable blending it balloons to 
> > > > > > 28/30ms.
>
> > > > > > This is testing on a Motorola Milestone, running 2.0.1.
>
> > > > > > Is this normal? Am I doing something wrong or is it just a common
> > > > > > problem in Android?
>
> > > > > > Any advice on how to attain 60fps drawing simple textured quads in 
> > > > > > 2D
> > > > > > using OpenGL?
>
> > > > > > Thanks in advance!
>
> > > > > > Regards,
> > > > > > Federico

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to