SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Introduction to Accelerometers and
OpenGL ES on the iPhone
    Jon Liang
●


        Mobility Lead – Mobclix
    ●


        http://www.mobclix.com
    ●



    Jeff LaMarche
●


        Author - Beginning iPhone Development: Exploring
    ●

        the iPhone SDK
        http://iphonedevelopment.blogspot.com/
    ●
Introduction to Accelerometers and
OpenGL ES on the iPhone
    OpenGL ES
●


    Accelerometer
●


    More OpenGL
●
OpenGL ES 1.1 - Open Graphics Library for
Embedded Systems
OpenGL




         Source:http://www.cs.unc.edu/~walk/pap//fig1.gif
OpenGL (continued)

    Platform independent
●


    Input
●


        Points, Lines, Polygons
    ●


        Transforms
    ●


        Textures
    ●


        Transparency
    ●


        Lighting
    ●
OpenGL Pipeline




                  Source: Apple
Code: Hello World
Quartz 2D vs. OpenGL for 2D

    Quartz 2D
●


        Higher Level API
    ●


            Compatible with
        –
            CoreAnimation
            Easier to Display Text
        –

        Inverted y-axis
    ●



    OpenGL
●


        Low Level API
    ●


            More Control
        –                            Source: Apple


            Less Overhead
        –

        3D
    ●
iPhone Limitations

    24 MB of Memory for textures and surfaces.
●


    The maximum texture size is 1024 x 1024.
●


    2D texture targets are supported; other texture
●

    targets are not.
    Stencil buffers aren’t available.
●


    More Info:
●


           http://developer.apple.com/iphone/library/documentation/i
       –
           Phone/Conceptual/iPhoneOSProgrammingGuide/Graphi
           csandDrawing/chapter_6_section_5.html#//apple_ref/doc
           /uid/TP40007072-CH10-SW18
Open GL → OpenGL ES

    Removed glBegin() and glEnd()
●


        Use glDrawArrays() or glDrawElements()
    ●




    Added Fixed Point data types
●


        Embedded systems often don't have FPU's.
    ●




    Removed convenience functions
●


        More lightweight implementation.
    ●
Questions?
Accelerometer
Accelerometer

    Hardware
●


        3-Axis MEMS Accelerometer
    ●


            Part Number: LIS302DL
        –

            Max Sample Rate: 400 Hz
        –

            Max Acceleration: ± 8g
        –

        No Gyroscope
    ●



    Implications
●


        No Direct Angular Acceleration Data
    ●


        Zeroed at Free Fall
    ●


        Limited Amplitude (± 4g per axis)
    ●
Basic Tasks: Signal Processing

    Isolating Large Movements
●


        Low-Pass Filter:
    ●


        xn = xn-1/2 + x/2
    Isolating Small Movements
●


        High-Pass Filter:
    ●

        xn = x - xn-1




                            Sournce: http://jp.physoc.org/content/vol550/issue3/fulltext/873/Figures/HiRes/873-F2.gif
Basic Tasks: Ground Angle

    2 Dimensions:
●

    Θ = atan(y/x)
    Axis-Plane:
●


    Θ = atan(z/sqrt(x2+y2))




                          Source: http://www.forestgumpsays.com/wp-content/uploads/2008/03/3iphoneaxes.jpg
Basic Tasks: Simple Gestures

    Swipe
●

    Positive-Negative Spike

    Shake
●

    Oscillating Wave

    Rotations
●

    2-Axis Change
Classes
 UIAccelerometer                                    UIAcceleration

 Methods                                            Properties
     + sharedAccelerometer                             UIAccelerationValue x
 Properties                                            UIAccelerationValue y
     updateInterval                                    UIAccelerationValue z
     delegate                                          NSTimeInterval timestamp



           MyClass <UIAccelerationDelegate>

           Methods
              - (void) accelerometer:(UIAccelerometer*) accelerometer
                        didAccelerate:(UIAcceleration*) acceleration




                                                                 MyOtherClass
Code: Hello World (continued)
Questions?
More Open GL
Apple Sample Code

    Accelerometer Graph
●


    Crash Landing
●


    GLGravity
●


    GLPaint
●


    GLSprite
●


    Touchfighter II
●
Additional Resources

    Open GL
●


        http://www.khronos.org/opengles/sdk/1.1/docs/man/
    ●


        http://www.glprogramming.com/red/
    ●



    Accelerometer
●


        www.st.com/stonline/products/literature/ds/12726.p
    ●

        df
        http://squallchua.blogspot.com/2008/12/wiimote-gesture
    ●


        http://ifiddling.blogspot.com/2009/01/dummy2.html
    ●
Additional Resources (continued)

    Collision Models
●


        http://www.metanetsoftware.com/technique/tutorialA
    ●

        .html
        http://www.metanetsoftware.com/technique/tutorialB
    ●

        .html
        http://www.euclideanspace.com/physics/dynamics/c
    ●

        ollision/index.htm

Mais conteúdo relacionado

Destaque

Destaque (6)

Physics Solutions for Innovative Game Design
Physics Solutions for Innovative Game DesignPhysics Solutions for Innovative Game Design
Physics Solutions for Innovative Game Design
 
Mehran Shaghaghi: Quantum Mechanics Dilemmas
Mehran Shaghaghi: Quantum Mechanics DilemmasMehran Shaghaghi: Quantum Mechanics Dilemmas
Mehran Shaghaghi: Quantum Mechanics Dilemmas
 
Coulomb Blockade Oscillations
Coulomb Blockade OscillationsCoulomb Blockade Oscillations
Coulomb Blockade Oscillations
 
Measuring the Surface Tension of Water by Light Diffraction on Capillary Waves
Measuring the Surface Tension of Water by Light Diffraction on Capillary WavesMeasuring the Surface Tension of Water by Light Diffraction on Capillary Waves
Measuring the Surface Tension of Water by Light Diffraction on Capillary Waves
 
A seminar report on Electric Propulsion
A seminar report on Electric PropulsionA seminar report on Electric Propulsion
A seminar report on Electric Propulsion
 
Quantum computing seminar
Quantum computing seminarQuantum computing seminar
Quantum computing seminar
 

Semelhante a Accelerometer and Open GL

Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
SamHoney6
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging System
Melissa Luster
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
slandelle
 

Semelhante a Accelerometer and Open GL (20)

Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Lab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer GraphicsLab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer Graphics
 
Os Wilhelm
Os WilhelmOs Wilhelm
Os Wilhelm
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging System
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, traps
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
Advanced JS Deobfuscation
Advanced JS DeobfuscationAdvanced JS Deobfuscation
Advanced JS Deobfuscation
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGL
 
MapReduce Algorithm Design
MapReduce Algorithm DesignMapReduce Algorithm Design
MapReduce Algorithm Design
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
 

Mais de John Wilker

Mais de John Wilker (20)

Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11
 
Introtoduction to cocos2d
Introtoduction to  cocos2dIntrotoduction to  cocos2d
Introtoduction to cocos2d
 
Getting Started with OpenGL ES
Getting Started with OpenGL ESGetting Started with OpenGL ES
Getting Started with OpenGL ES
 
User Input in a multi-touch, accelerometer, location aware world.
User Input in a multi-touch, accelerometer, location aware world.User Input in a multi-touch, accelerometer, location aware world.
User Input in a multi-touch, accelerometer, location aware world.
 
Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...
 
Getting Started with iPhone Game Development
Getting Started with iPhone Game DevelopmentGetting Started with iPhone Game Development
Getting Started with iPhone Game Development
 
Internationalizing Your Apps
Internationalizing Your AppsInternationalizing Your Apps
Internationalizing Your Apps
 
Optimizing Data Caching for iPhone Application Responsiveness
Optimizing Data Caching for iPhone Application ResponsivenessOptimizing Data Caching for iPhone Application Responsiveness
Optimizing Data Caching for iPhone Application Responsiveness
 
I Phone On Rails
I Phone On RailsI Phone On Rails
I Phone On Rails
 
Integrating Push Notifications in your iPhone application with iLime
Integrating Push Notifications in your iPhone application with iLimeIntegrating Push Notifications in your iPhone application with iLime
Integrating Push Notifications in your iPhone application with iLime
 
Starting Core Animation
Starting Core AnimationStarting Core Animation
Starting Core Animation
 
P2P Multiplayer Gaming
P2P Multiplayer GamingP2P Multiplayer Gaming
P2P Multiplayer Gaming
 
Using Concurrency To Improve Responsiveness
Using Concurrency To Improve ResponsivenessUsing Concurrency To Improve Responsiveness
Using Concurrency To Improve Responsiveness
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Mobile WebKit Development and jQTouch
Mobile WebKit Development and jQTouchMobile WebKit Development and jQTouch
Mobile WebKit Development and jQTouch
 
Accelerometer and OpenGL
Accelerometer and OpenGLAccelerometer and OpenGL
Accelerometer and OpenGL
 
Deep Geek Diving into the iPhone OS and Framework
Deep Geek Diving into the iPhone OS and FrameworkDeep Geek Diving into the iPhone OS and Framework
Deep Geek Diving into the iPhone OS and Framework
 
NSNotificationCenter vs. AppDelegate
NSNotificationCenter vs. AppDelegateNSNotificationCenter vs. AppDelegate
NSNotificationCenter vs. AppDelegate
 
Using SQLite
Using SQLiteUsing SQLite
Using SQLite
 
From Flash to iPhone
From Flash to iPhoneFrom Flash to iPhone
From Flash to iPhone
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Accelerometer and Open GL

  • 1. Introduction to Accelerometers and OpenGL ES on the iPhone Jon Liang ● Mobility Lead – Mobclix ● http://www.mobclix.com ● Jeff LaMarche ● Author - Beginning iPhone Development: Exploring ● the iPhone SDK http://iphonedevelopment.blogspot.com/ ●
  • 2. Introduction to Accelerometers and OpenGL ES on the iPhone OpenGL ES ● Accelerometer ● More OpenGL ●
  • 3. OpenGL ES 1.1 - Open Graphics Library for Embedded Systems
  • 4. OpenGL Source:http://www.cs.unc.edu/~walk/pap//fig1.gif
  • 5. OpenGL (continued) Platform independent ● Input ● Points, Lines, Polygons ● Transforms ● Textures ● Transparency ● Lighting ●
  • 6. OpenGL Pipeline Source: Apple
  • 8. Quartz 2D vs. OpenGL for 2D Quartz 2D ● Higher Level API ● Compatible with – CoreAnimation Easier to Display Text – Inverted y-axis ● OpenGL ● Low Level API ● More Control – Source: Apple Less Overhead – 3D ●
  • 9. iPhone Limitations 24 MB of Memory for textures and surfaces. ● The maximum texture size is 1024 x 1024. ● 2D texture targets are supported; other texture ● targets are not. Stencil buffers aren’t available. ● More Info: ● http://developer.apple.com/iphone/library/documentation/i – Phone/Conceptual/iPhoneOSProgrammingGuide/Graphi csandDrawing/chapter_6_section_5.html#//apple_ref/doc /uid/TP40007072-CH10-SW18
  • 10. Open GL → OpenGL ES Removed glBegin() and glEnd() ● Use glDrawArrays() or glDrawElements() ● Added Fixed Point data types ● Embedded systems often don't have FPU's. ● Removed convenience functions ● More lightweight implementation. ●
  • 13. Accelerometer Hardware ● 3-Axis MEMS Accelerometer ● Part Number: LIS302DL – Max Sample Rate: 400 Hz – Max Acceleration: ± 8g – No Gyroscope ● Implications ● No Direct Angular Acceleration Data ● Zeroed at Free Fall ● Limited Amplitude (± 4g per axis) ●
  • 14. Basic Tasks: Signal Processing Isolating Large Movements ● Low-Pass Filter: ● xn = xn-1/2 + x/2 Isolating Small Movements ● High-Pass Filter: ● xn = x - xn-1 Sournce: http://jp.physoc.org/content/vol550/issue3/fulltext/873/Figures/HiRes/873-F2.gif
  • 15. Basic Tasks: Ground Angle 2 Dimensions: ● Θ = atan(y/x) Axis-Plane: ● Θ = atan(z/sqrt(x2+y2)) Source: http://www.forestgumpsays.com/wp-content/uploads/2008/03/3iphoneaxes.jpg
  • 16. Basic Tasks: Simple Gestures Swipe ● Positive-Negative Spike Shake ● Oscillating Wave Rotations ● 2-Axis Change
  • 17. Classes UIAccelerometer UIAcceleration Methods Properties + sharedAccelerometer UIAccelerationValue x Properties UIAccelerationValue y updateInterval UIAccelerationValue z delegate NSTimeInterval timestamp MyClass <UIAccelerationDelegate> Methods - (void) accelerometer:(UIAccelerometer*) accelerometer didAccelerate:(UIAcceleration*) acceleration MyOtherClass
  • 18. Code: Hello World (continued)
  • 21. Apple Sample Code Accelerometer Graph ● Crash Landing ● GLGravity ● GLPaint ● GLSprite ● Touchfighter II ●
  • 22. Additional Resources Open GL ● http://www.khronos.org/opengles/sdk/1.1/docs/man/ ● http://www.glprogramming.com/red/ ● Accelerometer ● www.st.com/stonline/products/literature/ds/12726.p ● df http://squallchua.blogspot.com/2008/12/wiimote-gesture ● http://ifiddling.blogspot.com/2009/01/dummy2.html ●
  • 23. Additional Resources (continued) Collision Models ● http://www.metanetsoftware.com/technique/tutorialA ● .html http://www.metanetsoftware.com/technique/tutorialB ● .html http://www.euclideanspace.com/physics/dynamics/c ● ollision/index.htm