开发者

Huge latency on touches and accelerometer for Ipod Touch

I'm developing 开发者_运维百科an opengl es game for ios that requires accelerometer and multitouch. I have an EAGLView, that uses an ESRenderer where the drawing occurs.

the EAGLView implements the accelerometer and receives touches:

@interface EAGLView : UIView <UIAccelerometerDelegate> { ...

touchesBegan, touchesMoved and touchesEnded are also in this class.

All the logic for the game is split in several c++ classes for cross-platform reasons, in the drawView i send the acc. values to the game logic:

- (void)drawView:(id)sender
{
appAccelEvent(ax, ay, az);
if (sys_call == S_TOUCH_EVENT) {
    appTouchEvent(eventType, 0, cx0, cy0);
}
[renderer render];
}

I have been using an iphone with version 3.1.3 as testing device and everything is ok. but now i'm testing it on ipod touch with version 4.2.1 and the delay for the touch and accelerometer events to respond in the game is too large, sometimes between 1 and 2 segs.

I've been thinking it might be some kind of buffer for the accelerometer update interval that slows down the renderer. What else could be causing this lag?. i really appreciate any suggestions to fix it.


You should use CMMotionManager on iOS 4+, it's heavily tuned by Apple for performance and accuracy. Use it in poll mode (calling -deviceMotion periodically) in your game loop, it'll be much more performant than async notifications and just as accurate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜