Rapid taps on an OpenGL ES app introducing input delay

Posted by Tim R. on Stack Overflow See other posts from Stack Overflow or by Tim R.
Published on 2010-05-17T09:04:58Z Indexed on 2010/05/17 9:10 UTC
Read the original article Hit count: 227

Filed under:
|
|

I am starting out writing a 2D game in OpenGL ES, and I have encountered an odd problem: if I rapidly tap the touchscreen, the input starts lagging behind the display. The more times I tap, the more delay it causes between the input and any indication of that input onscreen.

It only happens if I intentionally tap very rapidly, but not from tapping and dragging with any number of fingers.

What could be causing this?

Excessive details follow:

Both accelerometer input and taps are delayed by just tapping.

The only events I am responding to are touchesBegan (below) in my EAGLView and accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration in my Game object.

There doesn't seem to be any upper limit to the amount of delay: I've gotten up to 12 seconds of delay by tapping rapidly with five fingers.

I have not seen any drops in framerate (it stays constantly at 60 fps) in the OpenGL ES tool in Instruments or by taking 1/the time between updates.

Possibly relevant code:

- (void) drawView:(id) sender
{
    [game update:allTouches];
    [renderer render:game];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{   
    allTouches = [event allTouches];
}

allTouches is a pointer that gets passed to my Game every update, which passes it to each GameObject in their update methods.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about opengl-es