Book Image

OpenFrameworks Essentials

Book Image

OpenFrameworks Essentials

Overview of this book

Table of Contents (19 chapters)
openFrameworks Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Deploying the project on an iOS device


If you have an iOS device, you can deploy our project on it. Before you can do that, you need to buy iOS Developer License from Apple (it costs $99 per year; see details at developer.apple.com/programs). Next, you should create a provisioning profile for the mobile device and a development certificate for your computer.

See the detailed instructions on this at openframeworks.cc/setup/iphone.

Using accelerometer

A typical iOS device has an accelerometer and a gyroscope to detect the motion and the orientation of the device respectively. openFrameworks has a built-in ofxAccelerometer class, which handles the accelerometer. Let's implement using it to control two sliders of the project using the following steps:

  1. Add the initialization of the accelerometer to setup():

    ofxAccelerometer.setup();
  2. Add the following commands to update() for getting the accelerometer's values and using them:

    ofPoint ori = ofxAccelerometer.getOrientation();
    twistX = ori.x;
    twistY ...