Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GLES20 big textured quad very slow (on Nexus One)

I render 2 triangles covering the whole surface using GLES20 context only. The problem is now that drawing just one single texture this way seems to be unreasonably slow. The framerate goes down from 58fps to 21fps.

  • the problem really seems to be the overall pixel area drawn of all quads together
  • bitmaps are resized to pow2 on loading
  • bitmaps are loaded with correct internal GL formats
  • using 8888 or 565 bitmap doesn't change anything
  • both vertex and fragment shader code is absolutely minimal
  • enabling/disabling blending doesn't change anything
  • drawing whole bitmap in one tile or in multiple tiles doesn't help
  • glDrawTexiOES doesn't seem to work with GLES20 (GL enum error)

I'm at a loss here; I thought blitting a single image in GL should be at least as quick as doing the same with Canvas, but it doesn't seem to be the case.

Can someone provide tips or an explanation of this performance hit?

Update:

I just adapted my rendering thread to support a canvas instead of EGL context and I do absolutely the same; showing an fps text and blitting a background texture. Guess what: showing the text only I get 58fps, adding the background picture I get... 57fps!

Now I am officially and very seriously pissed off. I hope that I am just not smart enough to use GLES20 well, otherwise it seems that if you want to blit 2D graphics - you take Canvas; and if and ONLY IF you want many triangles in 3D, then you take OpenGL.

Shouldn't OpenGL be always at least as fast as the 2D API provided by the Canvas?

like image 844
Alex Rempel Avatar asked Feb 02 '26 07:02

Alex Rempel


1 Answers

this is probably caused by large texture size and no mipmaps (because then the memory accesses can't be optimized very well), or by the texture not being power-of-two (because then the address calculation is harder - need to use multiply instead of a shift).

Hope this helps ...

like image 116
the swine Avatar answered Feb 03 '26 20:02

the swine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!