Download pptx - Pocket web gl sk

Transcript
Page 1: Pocket web gl sk

POCKET WEBGL

Page 2: Pocket web gl sk

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.”

Page 3: Pocket web gl sk
Page 4: Pocket web gl sk

Why do we want WebGL?

Platform shouldn’t hold back content

True portability with performance

Battery life

Page 5: Pocket web gl sk

HELLO WEBGL

Page 6: Pocket web gl sk

How do I WebGL?

Page 7: Pocket web gl sk

CREATE A SHADER (1/3)

Page 8: Pocket web gl sk

CREATE A SHADER (2/3)

Page 9: Pocket web gl sk

CREATE A SHADER (3/3)

Page 10: Pocket web gl sk

CREATE BUFFERS

Page 11: Pocket web gl sk

CREATE TEXTURES

Page 12: Pocket web gl sk

MATRIX STACK AND TRANSFORM (1/5)

Page 13: Pocket web gl sk

MATRIX STACK AND TRANSFORM (2/5)

Page 14: Pocket web gl sk

MATRIX STACK AND TRANSFORM (3/5)

Page 15: Pocket web gl sk

MATRIX STACK AND TRANSFORM (4/5)

Page 16: Pocket web gl sk

MATRIX STACK AND TRANSFORM (5/5)

Page 17: Pocket web gl sk

DRAWIMAGE AND STROKERECT (1/5)

Page 18: Pocket web gl sk

DRAWIMAGE AND STROKERECT (2/5)

Page 19: Pocket web gl sk

DRAWIMAGE AND STROKERECT (3/5)

Page 20: Pocket web gl sk

DRAWIMAGE AND STROKERECT (4/5)

Page 21: Pocket web gl sk

DRAWIMAGE AND STROKERECT (5/5)

Page 22: Pocket web gl sk

PROFILING

Page 23: Pocket web gl sk

MAKE A DEMO SCENE, MAKE IT SLOW

Page 24: Pocket web gl sk

DEVELOPER TOOLS

Page 25: Pocket web gl sk

2D CANVAS CONTEXT

Page 26: Pocket web gl sk

WEBGL CONTEXT

Page 27: Pocket web gl sk

JS PROFILE

Page 28: Pocket web gl sk

OPTIMIZE

Page 29: Pocket web gl sk

DRAW IMAGE (1/3)

Page 30: Pocket web gl sk

DRAW IMAGE (2/3)

Page 31: Pocket web gl sk

DRAW IMAGE (3/3)

Page 32: Pocket web gl sk

BUFFER RESIZE AND DRAW (1/2)

Page 33: Pocket web gl sk

BUFFER RESIZE AND DRAW (2/2)

Page 34: Pocket web gl sk

SINGLE DRAW ELEMENTS

Page 35: Pocket web gl sk

MOVING TO MOBILE

Page 36: Pocket web gl sk

OVERVIEW

Does it run WKWebView What’s different

Page 37: Pocket web gl sk

Tile-basedDeferred rendering

Page 38: Pocket web gl sk

TBDR

Hardware - PowerVR

What is the bottleneck

Mobile specific concerns

Page 39: Pocket web gl sk

TBDR

Draw calls are buffered and tiled

Hardware hidden surface removal

0 overdraw (only opaque fragments)

Page 40: Pocket web gl sk

Going deeper on mobileNative profiling

Page 41: Pocket web gl sk

Mobile Profiling

Instruments

OpenGL ES Analyzer

Custom build an app

Page 42: Pocket web gl sk

ResourcesResources

- 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)


Recommended