SlideShare ist ein Scribd-Unternehmen logo
1 von 42
POCKET 
WEBGL
What is WebGL? 
Khronos 
“WebGL is a cross-platform, royalty-free web standard for a low-level 
3D graphics API based on OpenGL ES 2.0, exposed through the 
HTML5 Canvas element as Document Object Model interfaces.”
Why do we want WebGL? 
Platform shouldn’t hold back content 
True portability with performance 
Battery life
HELLO WEBGL
How do I WebGL?
CREATE A SHADER (1/3)
CREATE A SHADER (2/3)
CREATE A SHADER (3/3)
CREATE BUFFERS
CREATE TEXTURES
MATRIX STACK AND TRANSFORM (1/5)
MATRIX STACK AND TRANSFORM (2/5)
MATRIX STACK AND TRANSFORM (3/5)
MATRIX STACK AND TRANSFORM (4/5)
MATRIX STACK AND TRANSFORM (5/5)
DRAWIMAGE AND STROKERECT (1/5)
DRAWIMAGE AND STROKERECT (2/5)
DRAWIMAGE AND STROKERECT (3/5)
DRAWIMAGE AND STROKERECT (4/5)
DRAWIMAGE AND STROKERECT (5/5)
PROFILING
MAKE A DEMO SCENE, MAKE IT SLOW
DEVELOPER TOOLS
2D CANVAS CONTEXT
WEBGL CONTEXT
JS PROFILE
OPTIMIZE
DRAW IMAGE (1/3)
DRAW IMAGE (2/3)
DRAW IMAGE (3/3)
BUFFER RESIZE AND DRAW (1/2)
BUFFER RESIZE AND DRAW (2/2)
SINGLE DRAW ELEMENTS
MOVING TO MOBILE
OVERVIEW 
Does it run WKWebView What’s 
different
Tile-based 
Deferred rendering
TBDR 
Hardware - PowerVR 
What is the bottleneck 
Mobile specific concerns
TBDR 
Draw calls are buffered and tiled 
Hardware hidden surface removal 
0 overdraw (only opaque fragments)
Going deeper on mobile 
Native profiling
Mobile Profiling 
Instruments 
OpenGL ES Analyzer 
Custom build an app
Resources 
Resources 
- OpenGL Insights (http://openglinsights.com/) 
- MDN (https://developer.mozilla.org/en-US/) 
- WebGL Spec (https://www.khronos.org/webgl/) 
- Your hardware vendor (http://www.imgtec.com/powervr/graphics.asp) 
- Your platform vendor (https://developer.apple.com/library/ios) 
- Learning WebGL (http://learningwebgl.com)

Weitere ähnliche Inhalte

Andere mochten auch

The Shifting Nature of FED Role
The Shifting Nature of FED RoleThe Shifting Nature of FED Role
The Shifting Nature of FED Role
FITC
 
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig FitzpatrickPageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
FITC
 

Andere mochten auch (19)

A Journey with React
A Journey with ReactA Journey with React
A Journey with React
 
Open Sourcing the Secret Sauce
Open Sourcing the Secret SauceOpen Sourcing the Secret Sauce
Open Sourcing the Secret Sauce
 
The Giddiest Kipper
The Giddiest KipperThe Giddiest Kipper
The Giddiest Kipper
 
Embedding Cognitive Innovation in Design
Embedding Cognitive Innovation in DesignEmbedding Cognitive Innovation in Design
Embedding Cognitive Innovation in Design
 
Getting to Know Grunt By Writing Your Own Plugin
Getting to Know Grunt By Writing Your Own PluginGetting to Know Grunt By Writing Your Own Plugin
Getting to Know Grunt By Writing Your Own Plugin
 
The Shifting Nature of FED Role
The Shifting Nature of FED RoleThe Shifting Nature of FED Role
The Shifting Nature of FED Role
 
Everydays
EverydaysEverydays
Everydays
 
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig FitzpatrickPageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
 
Building Tools for the Next Web
Building Tools for the Next WebBuilding Tools for the Next Web
Building Tools for the Next Web
 
“It’s all a matter of Perspective.” Incorporating Play to Help Solve Problems
“It’s all a matter of Perspective.” Incorporating Play to Help Solve Problems“It’s all a matter of Perspective.” Incorporating Play to Help Solve Problems
“It’s all a matter of Perspective.” Incorporating Play to Help Solve Problems
 
Cats, Dinosaurs and A Lot of Pizza with Reed + Rader
Cats, Dinosaurs and A Lot of Pizza with Reed + RaderCats, Dinosaurs and A Lot of Pizza with Reed + Rader
Cats, Dinosaurs and A Lot of Pizza with Reed + Rader
 
Designing True Cross-Platform Apps
Designing True Cross-Platform AppsDesigning True Cross-Platform Apps
Designing True Cross-Platform Apps
 
Kickstarting Your Stupid Magazine
Kickstarting Your Stupid MagazineKickstarting Your Stupid Magazine
Kickstarting Your Stupid Magazine
 
Creating Content that Captivates
Creating Content that CaptivatesCreating Content that Captivates
Creating Content that Captivates
 
Universal Applications
Universal ApplicationsUniversal Applications
Universal Applications
 
The Future is in Pieces
The Future is in PiecesThe Future is in Pieces
The Future is in Pieces
 
Unleashing the Power of 3D with WebJS
Unleashing the Power of 3D with WebJSUnleashing the Power of 3D with WebJS
Unleashing the Power of 3D with WebJS
 
Adapt or Die
Adapt or DieAdapt or Die
Adapt or Die
 
From Box to Bots in Minutes
From Box to Bots in MinutesFrom Box to Bots in Minutes
From Box to Bots in Minutes
 

Ähnlich wie Pocket web gl sk

WebGL demos showcase
WebGL demos showcaseWebGL demos showcase
WebGL demos showcase
Yukio Andoh
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
george.james
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
Dmitry Buzdin
 
Ajax: User Experience
Ajax: User ExperienceAjax: User Experience
Ajax: User Experience
petrov
 
HTML5 - Future of Web
HTML5 - Future of WebHTML5 - Future of Web
HTML5 - Future of Web
Mirza Asif
 
Getting Started with WebGL
Getting Started with WebGLGetting Started with WebGL
Getting Started with WebGL
Chihoon Byun
 

Ähnlich wie Pocket web gl sk (20)

WebGL demos showcase
WebGL demos showcaseWebGL demos showcase
WebGL demos showcase
 
WebGL: The Next Generation
WebGL:  The Next GenerationWebGL:  The Next Generation
WebGL: The Next Generation
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGL
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
WebGL For Game Development Spring 2013
WebGL For Game Development Spring 2013WebGL For Game Development Spring 2013
WebGL For Game Development Spring 2013
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
 
Ajax: User Experience
Ajax: User ExperienceAjax: User Experience
Ajax: User Experience
 
HTML5 - Future of Web
HTML5 - Future of WebHTML5 - Future of Web
HTML5 - Future of Web
 
Getting Started with WebGL
Getting Started with WebGLGetting Started with WebGL
Getting Started with WebGL
 
REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Unit 4 Java script.pptx
Unit 4 Java script.pptxUnit 4 Java script.pptx
Unit 4 Java script.pptx
 
[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 
Unobtrusive js
Unobtrusive jsUnobtrusive js
Unobtrusive js
 
Java script
Java scriptJava script
Java script
 
Akka Streams - From Zero to Kafka
Akka Streams - From Zero to KafkaAkka Streams - From Zero to Kafka
Akka Streams - From Zero to Kafka
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer Introduction
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 

Mehr von FITC

Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
FITC
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
FITC
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
FITC
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
FITC
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
FITC
 

Mehr von FITC (20)

Cut it up
Cut it upCut it up
Cut it up
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
 

Kürzlich hochgeladen

一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
Asmae Rabhi
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 

Kürzlich hochgeladen (20)

一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 

Pocket web gl sk

Hinweis der Redaktion

  1. Just so I can get an idea of the experience level of all of you, raise your hand if you have done the following: - Written an html5 canvas based application - Written an html5 canvas based application for mobile - Written a shader Written a webgl application This presentation is going to have a couple major sections. These include a narrated journey through my first experience with WebGL from first principles to a couple of optimization passes. Then we’ll look at how iOS8 in particular enables HTML 5 developers and we’ll also go through a number of best practices for mobile hardware with an additional focus on Apple’s hardware.
  2. WebGL is a specification similar to HTML itself. There are a couple other specifications that tie in very nicely with WebGL, namely typed Arrays and WebSockets.
  3. This is a fluid simulation done with smoothed particle hydrodynamics by miaumaiu interactive studio (http://miaumiau.cat)
  4. At BVG we having been building mobile html5 games for a couple years now. We started with relatively low expectations from a mobile html5 game. Our first prototype was a fully DOM based text game. It targeted the iphone 4. We saw what other games were capable of delivering, and we were really not happy with purely text based. So we decided to explore more graphical options. Initially this included a CSS animation based avatar system and a very “wide” map system. When I say “wide” here, I’m referring to the number of sibling nodes under the map container. We had several thousand of them in some cases. These systems performed pretty well actually. We decided to expand the avatar system to include a kind of 1v1 fight simulation. This required precise timing to trigger explosions, projectiles, and other effects. We had significant issues related to timing when using CSS animations. We also had issues with the map in terms of scrolling performance and attempting to layer effects on top. At this point we moved the map system to a canvas based approach. This was much more flexible and ended up giving us even more performance. We liked it so much that we moved the avatar system to a fully canvas implementation as well. By now we were using a full fledged scene graph model to display everything in our engine. Our performance gains became much harder to come by. At this point we really needed another big change to get to the next level. Going direct to the hardware is that change. We developed a mechanism of driving a native renderer from java script. This did end up working for our needs, but it was clunky and really a disaster in terms of usability. At this point WebGL had been maturing on desktop browsers for some time and we were really excited about the chance to use it for mobile. In fact, iAds had support for WebGL since iOS 5 and UIWebViews had a private API that could enable WebGL. These techniques were of course not possible for our production apps. With the release of iOS 8 everything changed. Not only do we get WebGL support in a public API, we also get a JIT for apps that use embedded web views. These are both massive improvements, and they compliment each other. The performance implications of these two features together has the end result of really allowing developers to say “yes” more to artists and designers. As a developer myself, this makes me happy. So let’s get into how we do it.
  5. https://gist.github.com/CShankland/c4da10206e99dfbcb61c - Context creation - Initialize viewport - Create a projection matrix - Create shaders - Create geometry - Draw
  6. https://gist.github.com/CShankland/b4974768e106fbbbbfe2 Actual shader text - Extremely simple texture enabled shader (single sampler)
  7. Create the GL objects and compile the shaders
  8. Then we link the shaders into a program and grab the attributes
  9. https://gist.github.com/CShankland/c813b3ce8d0f212159c2 Buffers are what we use to actually store data that is going to be sent through our shaders and allows us to give data to WebGL
  10. https://gist.github.com/CShankland/4afecc7dab1d2695e96d This is a simple function that will create a texture from either an HTML Image element or an HTML Canvas element.
  11. Camera functions https://gist.github.com/CShankland/c27fcccaae8c4f99bbf6
  12. Perspective transform https://gist.github.com/CShankland/c27fcccaae8c4f99bbf6
  13. https://gist.github.com/CShankland/0f3f04df4eb48b13da1a We have a matrix stack here that uses a pool
  14. https://gist.github.com/CShankland/b5193fb8e20ccd885076 This is the actual transform function
  15. https://gist.github.com/CShankland/b5193fb8e20ccd885076 Here’s the matrix multiply
  16. https://gist.github.com/CShankland/96546df7f2bab384f29a To draw an image we first set our uniforms
  17. https://gist.github.com/CShankland/96546df7f2bab384f29a Then we need to figure out which drawImage function is actually being called and set the parameters
  18. https://gist.github.com/CShankland/96546df7f2bab384f29a Then we update the data in our buffers and go ahead and draw
  19. https://gist.github.com/CShankland/9de3f502a208b1805658 Stroking a rectangle is similar to drawing an image except we don’t have a texture and we will use the uColor uniform
  20. https://gist.github.com/CShankland/9de3f502a208b1805658
  21. - Draw enough that it makes the frame rate low - Fire up the dev tools - What’s slow? - Canvas profiler - How many draw calls?
  22. - Draw enough that it makes the frame rate low - Fire up the dev tools - What’s slow? - Canvas profiler - How many draw calls?
  23. https://gist.github.com/CShankland/6381ec29d9b6aee91310 Batch by texture using a high water mark buffer
  24. https://gist.github.com/CShankland/6381ec29d9b6aee91310 Set the texture coordinates
  25. https://gist.github.com/CShankland/6381ec29d9b6aee91310 Set the indices and update our offsets
  26. https://gist.github.com/CShankland/fc867b9eca360b65a776 This is the helper function that makes sure we have space in our buffer. It’s going to use bufferData to actually allocate a new buffer
  27. https://gist.github.com/CShankland/fab4eb41548f84cadfd7 Here’s the draw function. We use bufferSubData to just replace the data in our buffer instead of allocating a new one, and then we make a single draw call for all of our primitives that use this texture
  28. It does actually run! WKWebView gives us another extremely important property – a JIT The things that are different are mostly concerned with the actual hardware that we’re running against.
  29. - Hardware (PowerVR) - What’s slow? - Memory access - Memory bandwidth - Power efficiency - Fast memory on-chip
  30. - Geometry is pre-processed into tiles this includes hidden surface removal - Then the fragments are textured and shaded - Finally the tile is written out to main memory - For fully opaque fragments, there is 0 overdraw - The hardware will automatically sort non-transparent fragments as well
  31. - There’s a whole new set of profiling tools to use on iOS - Instruments - Time profiler - OpenGL ES Analyzer - Unfortunately for us… - WebKit runs on a different process - You can’t attach the OGLES analyzer to it - You can’t get debug symbols - What can you do? - Read the source - Use Chrome or another profiler to trace your OGL calls and run them in a native app