views:

770

answers:

1

Hi,

I'm trying to optimize my iPhone OpenGL ES app. This is based on the GLSprite and GLPaint sample apps. I've factored out EAGLView into a base class, and I'm subclassing it in 3 different OpenGL views to make 3 transparent layers. The display parent for the 3 EAGLViews is a UIView, and that UIView is a child of the UIWindow. I'm trying to get this as close as possible to 60fps. I've heard others on this site saying that the iPhone is capable of drawing 50 transparent layers at 60fps, so that's encouraging...

What I'm doing is:

1) Drawing up to 9 textured lines, using the same point-sprite based function as in GLPaint (renderLineFromPoint:toPoint:) to layer #1. The texture used for this is 64x64, with a 40x40 circle in the middle and the rest is transparent.

2) Drawing a single line with that same function and texture to layer #2.

3) Drawing 9 instances of a 128x128 texture (an 80x80 centered circle with the rest transparent) to layer #3. This layer is on top.

Layers #1 and #3 change very seldomly, and layer #2 changes (erase full screen, redraw a single line) every time touchesMoved: is called.

Originally I tried doing this in a single EAGLView, like the samples... basically draw content for all 3 layers in order. However, this was too slow. It was fine before I added the line drawing (layers 1 and 2), but unfortunately drawing 10 lines every touchedMoved was cutting the framerate in half. So I tried optimizing it by splitting them out to layers... draw each layer ONCE only when necessary. (Drawing layer 2 every finger movement). This is still not fast enough, I'm supposing because there is lots of transparency (each layer needs to show through; also every texture draw needs to blend).

I don't think I'm doing a LOT of drawing... is 9 translucent quads and several lines a lot?

So, am I doomed here? Using this much transparency kills performance? Or is there something I'm missing... any help is very much appreciated!

A: 

i fixed this by removing layer #1. now, layer #2 handles both static and dynamic line drawing. back to 60fps! :)

i guess the iphone just crapped out on compositing 3 fullscreen transparent layers...

monkey32