SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

Destacado (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
 

Similar 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
 

Similar 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
 

Más de John Wilker

Más 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

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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