iPhone Accelerometer still not registering!
I've heard changing the color-format to kEAGLColorFormatRGBA8 often solves this problem but it didn't for my app. Here is the code
// Get the layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = YES;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
I've also heard you need to specific the delegate first when you start the accelerometer.
//Configure and start accelerometer
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)];
Finally, here is where I do my accelerometer calculations:
// Implement this method to get the lastest data from the accelerometer
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
{
//Use a basic low-pass filter to only keep the gravity in the accelerometer values
_accelerometerX = acceleration.x * kFilteringFactor + _accelerometerX * (1.0 - kFilteringFactor);
}
Does anyone see where I'm making my mistake?
Mac Pro, Two 3GHz Dual-Core Intel Xeon, 410 GB HD, NVIDIA 7300 GT, Mac OS X (10.5.2), Macbook Air, 1.6GHz Core 2 Duo, 80GB HD, 2GB RAM