Question about accelerometer and OpenGL (ES)
Question about accelerometer and OpenGL (ES)
- Subject: Question about accelerometer and OpenGL (ES)
- From: William Squires <email@hidden>
- Date: Mon, 27 Oct 2014 12:03:14 -0500
I'm trying to write a simple demo app and need to know two things:
1) How can I translate the output from the accelerometer into an angular deflection from the x- or y-axis (if you think of the device as an airplane, with the cockpit near the FaceTime camera, and the tail near the home button, then the long axis of the phone is the y-axis (roll), and the semi-long axis is the x-axis (pitch). I don't care about yaw, or rotation about the z-axis, which points into and out of the device). I need to get the angle, theta, when - for example - there's a 1 degree pitch down. This way, I can move the light source for rendering by that angle off the z-axis.
So, for the above example, when I pitch down the device 1 degree, with the light source originally @ (0, 0, z), then the distance (in cm, or whatever) that the front edge of the phone dips below the x-y plane is some value 'q' - then I can make the new light source vector (0, q, z), and the angle between this new vector and the original one is 1 degree. Likewise, if I pitch up 1 degree, then the new lighting (position) vector would be (0, -q, z). What I don't know are what units the accelerometer is giving me? (meters per sec sq? centimeters/s^2? millimeters? 1/10ths of an inch? or is it a percentage of 'g'=-9.81m/s^2 here on Earth, anyway?)
2) Is OpenGL(ES) fast enough for rendering material effects (like shining a light source on a shiny piece of (simulated) aluminum panel)? Or should I rely on a pre-rendered texture atlas? I assume the new "Metal" (in iOS 8) will be, but I want to target iOS 7 as well.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden