Computer Graphics on Mobile Deviceson Mobile Devices
VL SS2010 3.0 ECTS
Peter Rautek
MotivationSmartphonemarkt starkwachsendI t tiIntegration von
Kamera3D Grafik3D GrafikInternetPCTelefon
AnwendungenS i lSpieleAugmented RealityVisualisierung (GoogleVisualisierung (Google Earth, Maps, etc.)TV
Peter Rautek 1
Vorlesungsteil
3 EinheitenEi h it IEinheit I
Vorbesprechung der LaborübungAndroid Basics
Einheit IIEinheit IIAdvanced Android TopicsOpenGL ES
Einheit IIIEinheit IIIPlattformübergreifende Entwicklung
Peter Rautek 2
Fähigkeiten für die VL
Mobile PlattformenAndroidAndroid
ComputergraphikOpenGL ES 1.0 (und 2.0)Ev Bildbearbeitung Modellierung etcEv. Bildbearbeitung, Modellierung, etc.
Software EngineeringVersion ControlEclipse oder andere EntwicklungsumgebungEclipse oder andere EntwicklungsumgebungJava
Peter Rautek 3
Laborübungsteil
ZieleEntwicklung eines gemeinsamen Spielesg g pOpen Source VeröffentlichungEv. Veröffentlichung am Android Marketg
Gruppenarbeit (in 2er Gruppen)Implementieren eines Levels (zu Hause oder im VisLab)Implementieren eines Levels (zu Hause oder im VisLab)
ZwischengesprächAbgabegesprächAbgabegesprächPräsentation
OptionalOptionalFAQ Event (vorraussichtlich 2 Events)
Peter Rautek 4
FAQ Events
Informelles Treffen (offen und ohne fixe Struktur)Kurzer Vortragsteil über häufige Probleme undKurzer Vortragsteil über häufige Probleme und LösungenKurz Probleme und Erfolge besprechenKurz Probleme und Erfolge besprechen
Level Entwürfe disskutierenM i i h lMeinungen einholen
Coding SessionAblauf:
Probleme postenpCode commitLaptop mitbringen!p p g
Peter Rautek 5
Zwischengespräch
Interne Präsentation der (vorläufigen) ErgebnisseErgebnisse15-30 Minuten pro GruppeStatusbestimmungFeedback zuFeedback zu
StatusGameplay
Peter Rautek 6
The Big and Incredibly Funny (Inverse) Treasure Hunt
Inverse SchatzsucheH f d G ldHerausforderung: Gold
VerlierenVersteckenAusgebenAusgeben
Individuelle Levels Originelle UmsetzungGame PlayGame PlayAnsprechende Graphik
Peter Rautek 7
Laborübungsframework
MenüLauncher für SpielHelpHelpAboutCreditsEnable/DisableEnable/Disable Debugging
Peter Rautek 8
Laborübungsframework
MapZ fälliZufällige Zuordnung von LevelsLauncher für LevelsLauncher für LevelsSpielerfortschrittLevelicons
Peter Rautek 9
Laborübungsframework
DebugI di id ll H l A ti itIndividuelle Help ActivityIndividuelle Level Activity
CheckboxAutomatischer Start desAutomatischer Start des spezifizierten Levels
Explizite Zuordnung der Levels
Peter Rautek 10
Demo
Peter Rautek 11
Spielentwurf
Von Anfang an beachtenSpielgeschichteSpielgeschichteGame playAbbildung von Game play auf HardwareInput/OutputInput/Output
EinschränkungenEmulator ist nicht ident mit HardwareInhalteInhaltePerformance
Peter Rautek 12
Inhalte
Creative Commons2D G hik2D Graphik3D ModelleLevel editorA l it /HilfAnleitung/HilfeTutorialSound
Peter Rautek 13
Laborübungsablauf
3 PhasenPhase I – Alles ausprobieren und Level spezifizierenPhase I – Alles ausprobieren und Level spezifizieren
Aufsetzen der EntwicklungsumgebungAndroid „Hello World“VL Framework ausprobierenEigenes Level EntwerfenLevel Beschreibung (Hilfe) integrierenLevel Beschreibung (Hilfe) integrierenLevel einchecken (=Anmeldung zur VL)
Ph II I l i d F k i li äPhase II – Implementieren der FunktionalitätPhase III – Testen und Verschönern
Peter Rautek 14
Laborübungsablauf
Peter Rautek 15
Phase I
DemoDemoVoraussetzung
EclipseEclipseSVNAndroidAndroid
EclipseLevel IntegrationLevel IntegrationAndroidManifestH l A i iHelpActivityEmulator
Peter Rautek 16
Integration der Levels
Zwei MöglichkeitenDirekt im “trunk” arbeiten (empfohlen)Direkt im “trunk” arbeiten (empfohlen)Eigenes Setup – Level später integrieren
Auf jeden FallNamenskonflikte vermeidenNamenskonflikte vermeidenConventions (lxx_...)
LayoutStringsStringsView Ids (User-interface)M sic So nds Te t res etcMusic, Sounds, Textures, etc.
Peter Rautek 17
Überblick
Ei l it VLEinleitung zur VL
Fragen ?Android
Peter Rautek 18
Android
Software stack for mobile devices
Peter Rautek 19
Android Framework
SDK JavaNDK C d C++NDK C and C++No native applicationsppEmulator / Hardware
Peter Rautek 20
Android Specific Concepts
ActivityA screen the user can see and interact with
ContentProviderExchanging contentg g
PermissionsUser will have to grant permissions at install timeUser will have to grant permissions at install time
ServiceA background processA background process
BroadcastEvents that might be of interestEvents that might be of interest
IntentLate binding mechanismLate binding mechanism
Peter Rautek 21
Demo
HomeActivity ManagerActivity ManagerContent ProviderNotification ManagerLocation ManagerPackage ManagerCameraCameraIntentsM kMarketPermissions
Peter Rautek 22
Activity
Basic concept for user interactionVi & L tViews & LayoutsStarted with intentReturn result to calling activityR i it th dRuns in its own thread
Must be kept reactivepActivity not responding (ANR) dialog(ANR) dialog
Peter Rautek 23
Activity Lifecycle
State changesCreateCreateStart ResumePausePause StopDestroy
MultitaskingMultitaskingMaintain continuoususer interaction
Peter Rautek 24
Activity Lifecycle
ExampleUser plays a gameUser plays a game Answers a phone callEnters info into calendarService syncs calendar email etcService syncs calendar, email, etc.User continuous the conversationEnds the phone callGoes to toilet - phone enters sleep modeGoes to toilet phone enters sleep modeUser continuous playing game
Peter Rautek 25
Activity Lifecycle
Activity might be Paused:Paused:
Pause all running threadsStore the state
Resumed:Resumed:Restore stateR ll th dResume all threads
Destroyed:Stop all threadsStore persistent objectsStore persistent objects
Peter Rautek 26
Persistence
Xml File Name value pairsName, value pairsE.g., store text, store user progress
InstanceStateE g store cursor position music track etcE.g., store cursor position, music track, etc.onSaveInstanceState(Bundle out)onRestoreInstaceState(Bundle in)onCreate(Bundle in)onCreate(Bundle in)
DatabasePlain text files
Peter Rautek 27
Resources
Resource (./res folder)DrawablesDrawablesLayoutsValuesRaw (sound video etc )Raw (sound, video, etc.)
Automatically generated R file (./gen folder)Easy to referenceEclipse auto-completionEclipse auto-completion
Configuration dependentChanged automatically
Peter Rautek 28
Emulator
Android Virtual Device (AVD)C fi tiConfigurationAVD ManagergInteraction withEclipseEclipse Functionkeys
F1-F12F6: TrackballF6: TrackballCtrl F12: Landscape – Portrait ModeOpenGL ES: no performance estimate
Peter Rautek 29
Development with Eclipse
BreakpointsV i blVariablesPerspectivespLogCat
FiltFiltersCallstackSubclipse
T itTeam itemBrowserImport
Peter Rautek 30
Where to Start? – Links!
Download these slides and explore the linksCGMD Homepagep ghttp://www.cg.tuwien.ac.at/courses/CGMD/
Google IO Videos:A d id b iAndroid basics
http://sites.google.com/site/io/building-an-android-application
Real time games for Androidghttp://code.google.com/events/io/2009/sessions/WritingRealTimeGamesAndroid.html
Khronos OpenGL EShttp://www.khronos.org/opengles/1 X/p // o os o g/ope g es/ _ /
Blogs about Android and OpenGL ESRobert Green http://www.rbgrn.net/topic/programming/allp g p p g g
Replica Island http://replicaisland.blogspot.com/
Per-Erik Bergman http://blog.jayway.com/author/pererikbergman/Per Erik Bergman http://blog.jayway.com/author/pererikbergman/
Peter Rautek 31
Danke für Ihre Aufmerksamkeit
F ?Fragen?
Viel Spass beim Coden!Peter Rautek 32
Viel Spass beim Coden!