SlideShare a Scribd company logo
1 of 21
WebGL, HTML5…
and how the mobile web
was won
tony parisi
Vizi, inc.
march 25, 2014
image: http://www.bitrebels.com
3/25/20
14
http://www.tonyparisi.com
image:
http://www.arvindsaba.blogspot.com/
+ =
a wild web of app development
… and one
platform to
rule them
all…
3/25/20
14
http://www.tonyparisi.com
the web browser as platform
fast JavaScript virtual machines
hardware-accelerated compositing
animation support
Workers, WebSockets, local storage, local databases
new language initiatives: Dart, Typescript, asm.js
mobile-inspired features: location, touch, device orientation…
mobile platforms rapidly adopting all HTML5 features in browsers
and embedded WebView controls - near-ubiquity
3/25/20
14
http://www.tonyparisi.com
breakthrough applications
3/25/20
14
http://www.tonyparisi.comhttp://www.tonyparisi.com
ported in 5 days Unreal native C++ engine -> JavaScript Emscripten + asm.js60FPS
bringing the power of the GPU
to the web
WebGL hardware-accelerated 3D rendering
CSS 3D hardware-accelerated transforms, transitions, and
animations
3/25/20
14
http://www.tonyparisi.com
OpenGL ES™ in a browser
JavaScript API bindings
shipped since early 2011
supported in all modern browsers
• desktop Safari, Firefox, Chrome, Opera, Internet Explorer
• iOS mobile Safari – iAds only
• Android – mobile Chrome, mobile Firefox
• Blackberry, Tizen, Firefox OS, Amazon FireOS (Kindle Fire
HDX)
• Surface (Windows 8.1)
• NVIDIA Shield
over 1B served
http://www.tonyparisi.com
3/25/20
14
the 3D API standard for the web
100,000 Stars Google Experiment
http://workshop.chromeexperiments.com/stars/
how WebGL works
JavaScript API to OpenGL ES (version 2.0)
draw to a canvas element using a special context
low-level drawing – buffers, primitives, textures and shaders
accelerated by graphics hardware (GPU)
can draw 2D as well as 3D graphics
there is no file format; no markup language; no DOM.
http://www.tonyparisi.com
3/25/20
14
a simple WebGL program
1. create a <canvas> element
2. obtain a drawing context
3. initialize the viewport
4. create one or more buffers
5. create one or more matrices
6. create one or more shaders
7. initialize the shaders
8. draw one or more primitives
http://www.tonyparisi.com
3/25/20
14
create the canvas, context and
viewport
3/25/20
14
http://www.tonyparisi.com
function initWebGL(canvas) {
var gl = null;
var msg = "Your browser does not support WebGL, " +
"or it is not enabled by default.";
try
{
gl = canvas.getContext(“webgl");
}
catch (e)
{
msg = "Error creating WebGL Context!: " + e.toString();
}
if (!gl)
{
alert(msg);
throw new Error(msg);
}
return gl;
}
function initViewport(gl, canvas)
{
gl.viewport(0, 0, canvas.width, canvas.height);
}
detect WebGL
set WebGL drawing
region
buffers and typed arrays
var vertexBuffer;
vertexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
var verts = [
// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
-1.0, 1.0, 1.0,
// Back face
-1.0, -1.0, -1.0,
-1.0, 1.0, -1.0,
1.0, 1.0, -1.0,
1.0, -1.0, -1.0,
…
];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);
WebGL drawing functions
use buffers of data
new low-level data type
stores arrays of floats
and ints compactly
http://www.tonyparisi.com
3/25/20
14
shaders
var vertexShaderSource =
" attribute vec3 vertexPos;n" +
" attribute vec2 texCoord;n" +
" uniform mat4 modelViewMatrix;n" +
" uniform mat4 projectionMatrix;n" +
" varying vec2 vTexCoord;n" +
" void main(void) {n" +
" // Return the transformed and projected vertex valuen" +
" gl_Position = projectionMatrix * modelViewMatrix * n" +
" vec4(vertexPos, 1.0);n" +
" // Output the texture coordinate in vTexCoordn" +
" vTexCoord = texCoord;n" +
" }n";
var fragmentShaderSource =
" precision mediump float;n" +
" varying vec2 vTexCoord;n" +
" uniform sampler2D uSampler;n" +
" void main(void) {n" +
" // Return the pixel color: always output whiten" +
" gl_FragColor = texture2D(uSampler, vec2(vTexCoord.s, vTexCoord.t));n" +
"}n";
the vertex shader
transforms model-space
positions into screen space
the fragment shader outputs
a color value for each pixel
http://www.tonyparisi.com
3/25/20
14
drawingfunction draw(gl, obj) {
// clear the background (with black)
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.enable(gl.DEPTH_TEST);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// set the shader to use
gl.useProgram(shaderProgram);
// connect up the shader parameters: vertex position, texture coordinate,
// projection/model matrices and texture
// set up the buffers
gl.bindBuffer(gl.ARRAY_BUFFER, obj.buffer);
gl.vertexAttribPointer(shaderVertexPositionAttribute, obj.vertSize, gl.FLOAT, false, 0, 0);
gl.bindBuffer(gl.ARRAY_BUFFER, obj.texCoordBuffer);
gl.vertexAttribPointer(shaderTexCoordAttribute, obj.texCoordSize, gl.FLOAT, false, 0, 0);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, obj.indices);
gl.uniformMatrix4fv(shaderProjectionMatrixUniform, false, projectionMatrix);
gl.uniformMatrix4fv(shaderModelViewMatrixUniform, false, modelViewMatrix);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, webGLTexture);
gl.uniform1i(shaderSamplerUniform, 0);
// draw the object
gl.drawElements(obj.primtype, obj.nIndices, gl.UNSIGNED_SHORT, 0);
}
clear the canvas
set the shader
set up buffers for
vertices and texture
coordinates
pass transform and
projection matrices
to the shader
set the texture and pass to
the shader
draw the object
http://www.tonyparisi.com
3/25/20
14
engines and frameworks
3/25/20
14
http://www.tonyparisi.com
game engines/IDEs
Goo
Enginehttp://www.gootechnologies.co
m/
Verold http://verold.com/
Turbulenz https://turbulenz.com/
PlayCanvas
http://www.playcanvas.com/
Artillery Engine
https://artillery.com/
Sketchfab https://sketchfab.com/
Unreal
https://www.unrealengine.com/
Unity http://unity3d.com/#unity-5
scene graph libraries/page frameworks
Three.js
http://threejs.org/
SceneJS
http://scenejs.org/
BabylonJS
http://www.babylonjs.com/
Vizi
https://github.com/tparisi/Vizi
Voodoo.js
http://www.voodoojs.com/
PhiloGL
http://www.senchalabs.org/philogl/
tQuery
http://jeromeetienne.github.io/tquery/
3/25/20
14
http://www.tonyparisi.com
model from 3drt.com
glTF: a “JPEG for 3D”
full-featured: scene layout, cameras, lights, animations
JSON for scene structure; binary buffers for model data
intended for WebGL and OpenGL ES mobile applications
CSS3 3D transforms
translate, rotate, scale page elements with perspective
.bk-list li {
perspective: 1800px;
}
.bk-list li .bk-front {
transform-style: preserve-3d;
transform-origin: 0% 50%;
transform: translate3d(0,0,20px);
}
.bk-list li .bk-book.bk-bookdefault:hover {
transform: rotate3d(0,1,0,35deg);
}
http://tympanus.net/codrops/2013/01/08
/3d-book-showcase/
browser will render element in 3D perspective
add origin to
translation
apply to child
elements
apply 35 degree rotation about Y axis
http://www.tonyparisi.com
3/25/20
14
even 2D graphics are
accelerated if 3D transform
functions are used e.g.
translate3d(10, 20, 0);
winning the mobile 3d web
HTML5 runs in all mobile browsers, and as embedded
WebView components in apps
WebGL is supported in most mobile environments
• iOS mobile Safari – iAds only
• Android – mobile Chrome, mobile Firefox
• Blackberry, Tizen, Firefox OS, Amazon FireOS (Kindle Fire
HDX)
• Surface (Windows 8.1)
• NVIDIA Shield
CSS 3D transforms are supported in all mobile environments
3/25/20
14
http://www.tonyparisi.com
cross-browser HTML5 and
WebGL
3/25/20
14
http://www.tonyparisi.com
hybrid app development
use CocoonJS™
http://ludei.com/
or Impact Ejecta
desktop HTML5 and
WebGL
all browsers support all
features, nearly identically
mobile WebGL
• iOS - mobile Safari – iAds only
• Android – mobile Chrome,
Firefox
• Amazon Silk, Kindle Fire OS
• Blackberry, Tizen, Firefox OS
• NVIDIA Shield
the tipping point
3/25/20
14
http://www.tonyparisi.com
Microsoft now fully supports WebGL in IE and Windows mobile.
Kindle Fire HDX: at $229, the 7” is probably the best multimedia
device deal on the planet… thanks in part to WebGL.
Sony built the whole PS4 user interface out of WebGL. 4.2M seats in
one whack… and growing.
the 2013 NORAD Tracks Santa site saw 48.8% WebGL success across
all browsers & platforms for 20M visitors, an increase of 146% over
2012.
Opera Devices SDK – WebGL coming soon to a Bang & Olufsen TV
near you!
pro game middleware (Unreal, Unity) fully on board
CSS 3D transforms are supported on all platforms
can Apple be far behind… ?
on the frontier…
WebGL 2!
based on GL ES 3
will contain popular WebGL
extensions
just getting under way – no
dates yet
image: http://www.bitrebels.com
WebCL
Heterogeneous parallel computing
JavaScript
based on OpenCL 1.1
experimental –browser extensions
and custom Chromium builds
no ship dates announced yet
stay in touch…
contact information
tparisi@gmail.com
skype: auradeluxe
http://twitter.com/auradeluxe http://w
ww.tonyparisi.com/
http://www.learningwebgl.com/
get the books!
WebGL: Up and Running
http://www.amazon.com/dp/144932357X
Programming 3D Applications with HTML and WebGL
http://www.amazon.com/Programming-Applications-HTML5-
WebGL-Visualization/dp/1449362966
http://www.tonyparisi.com
3/25/20
14
get Vizi
https://github.com/tparisi/Vizi
SF WebGL Meetup
http://www.meetup.com/WebGL-Developers-Meetup/
book source code
https://github.com/tparisi/WebGLBook
https://github.com/tparisi/Programming3DApplications

More Related Content

What's hot

Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010
Patrick Lauke
 

What's hot (8)

Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010
 
Bruce lawson-over-the-air
Bruce lawson-over-the-airBruce lawson-over-the-air
Bruce lawson-over-the-air
 
Bruce Lawson, Web Development 2.0, SparkUp! Poznan Poland
Bruce Lawson, Web Development 2.0, SparkUp! Poznan PolandBruce Lawson, Web Development 2.0, SparkUp! Poznan Poland
Bruce Lawson, Web Development 2.0, SparkUp! Poznan Poland
 
Javascript native OOP - 3 layers
Javascript native OOP - 3 layers Javascript native OOP - 3 layers
Javascript native OOP - 3 layers
 
HTML5 Intro
HTML5 IntroHTML5 Intro
HTML5 Intro
 
WebUSB
WebUSBWebUSB
WebUSB
 
Real solutions, no tricks
Real solutions, no tricksReal solutions, no tricks
Real solutions, no tricks
 
Puppeteer can automate that! - HolyJS Piter 2020
Puppeteer can automate that! - HolyJS Piter 2020Puppeteer can automate that! - HolyJS Piter 2020
Puppeteer can automate that! - HolyJS Piter 2020
 

Viewers also liked

Viewers also liked (20)

Powering the VR/AR Ecosystem 2017-01-17
Powering the VR/AR Ecosystem 2017-01-17Powering the VR/AR Ecosystem 2017-01-17
Powering the VR/AR Ecosystem 2017-01-17
 
Virtually Anyone
Virtually AnyoneVirtually Anyone
Virtually Anyone
 
Foundations of the Immersive Web
Foundations of the Immersive WebFoundations of the Immersive Web
Foundations of the Immersive Web
 
Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGL
 
An Introduction to Web VR January 2015
An Introduction to Web VR January 2015An Introduction to Web VR January 2015
An Introduction to Web VR January 2015
 
The Immersive Web
The Immersive WebThe Immersive Web
The Immersive Web
 
WebVR Ecosystem and API Update
WebVR Ecosystem and API UpdateWebVR Ecosystem and API Update
WebVR Ecosystem and API Update
 
WebVR: Developing for the Immersive Web
WebVR: Developing for the Immersive WebWebVR: Developing for the Immersive Web
WebVR: Developing for the Immersive Web
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.js
 
Intro to Three.js
Intro to Three.jsIntro to Three.js
Intro to Three.js
 
A-Frame: VR for Web Developers
A-Frame: VR for Web DevelopersA-Frame: VR for Web Developers
A-Frame: VR for Web Developers
 
WebGL and three.js - Web 3D Graphics
WebGL and three.js - Web 3D Graphics WebGL and three.js - Web 3D Graphics
WebGL and three.js - Web 3D Graphics
 
Build the Virtual Reality Web with A-Frame
Build the Virtual Reality Web with A-FrameBuild the Virtual Reality Web with A-Frame
Build the Virtual Reality Web with A-Frame
 
Introduction to WebGL and WebVR
Introduction to WebGL and WebVRIntroduction to WebGL and WebVR
Introduction to WebGL and WebVR
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVR
 
OpenGL SC 2.0 Quick Reference
OpenGL SC 2.0 Quick ReferenceOpenGL SC 2.0 Quick Reference
OpenGL SC 2.0 Quick Reference
 
WebVR
WebVRWebVR
WebVR
 
WebVR - MobileTechCon Berlin 2016
WebVR - MobileTechCon Berlin 2016WebVR - MobileTechCon Berlin 2016
WebVR - MobileTechCon Berlin 2016
 
An Introduction to WebVR – or How to make your user sick in 60 seconds
An Introduction to WebVR – or How to make your user sick in 60 secondsAn Introduction to WebVR – or How to make your user sick in 60 seconds
An Introduction to WebVR – or How to make your user sick in 60 seconds
 

Similar to WebGL, HTML5 and How the Mobile Web Was Won

Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Esri Nederland
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
Tony Parisi
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 

Similar to WebGL, HTML5 and How the Mobile Web Was Won (20)

WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony ParisiWT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
 
Building Rich Internet Applications with HTML5 and WebGL
Building Rich Internet Applications with HTML5 and WebGLBuilding Rich Internet Applications with HTML5 and WebGL
Building Rich Internet Applications with HTML5 and WebGL
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
 
Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5
 
HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!
 
Firefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-webFirefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-web
 
HTML5 and CartoDB
HTML5 and CartoDBHTML5 and CartoDB
HTML5 and CartoDB
 
Building AR and VR Experiences for Web Apps with JavaScript
Building AR and VR Experiences for Web Apps with JavaScriptBuilding AR and VR Experiences for Web Apps with JavaScript
Building AR and VR Experiences for Web Apps with JavaScript
 
3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.
 
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?
 
Location Based Services Without the Cocoa
Location Based Services Without the CocoaLocation Based Services Without the Cocoa
Location Based Services Without the Cocoa
 
Browser-Based Virtual Reality April 2015
Browser-Based Virtual Reality April 2015Browser-Based Virtual Reality April 2015
Browser-Based Virtual Reality April 2015
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.js
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 

More from Tony Parisi

More from Tony Parisi (16)

The New Fine Arts
The New Fine ArtsThe New Fine Arts
The New Fine Arts
 
Face the Future: Computing in an Augmented World
Face the Future: Computing in an Augmented WorldFace the Future: Computing in an Augmented World
Face the Future: Computing in an Augmented World
 
Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016
 
React-VR: An Early Experiment with React and WebGL for VR Development
React-VR: An Early Experiment with React and WebGL for VR DevelopmentReact-VR: An Early Experiment with React and WebGL for VR Development
React-VR: An Early Experiment with React and WebGL for VR Development
 
Vrml, or There and Back Again
Vrml, or There and Back AgainVrml, or There and Back Again
Vrml, or There and Back Again
 
The Coming Distribution War
The Coming Distribution WarThe Coming Distribution War
The Coming Distribution War
 
VR Without Borders RIVER WebVR April 2015
VR Without Borders RIVER WebVR April 2015VR Without Borders RIVER WebVR April 2015
VR Without Borders RIVER WebVR April 2015
 
glTF and the WebGL Art Pipeline March 2015
glTF and the WebGL Art Pipeline March 2015glTF and the WebGL Art Pipeline March 2015
glTF and the WebGL Art Pipeline March 2015
 
Up And Running With Web VR Fall 2014
Up And Running With Web VR Fall 2014Up And Running With Web VR Fall 2014
Up And Running With Web VR Fall 2014
 
The Web Eats Everything In Its Path Fall 2014
The Web Eats Everything In Its Path Fall 2014The Web Eats Everything In Its Path Fall 2014
The Web Eats Everything In Its Path Fall 2014
 
WebGL, WebVR and the Metaverse
WebGL, WebVR and the MetaverseWebGL, WebVR and the Metaverse
WebGL, WebVR and the Metaverse
 
And Who Shall Control the Metaverse?
And Who Shall Control the Metaverse?And Who Shall Control the Metaverse?
And Who Shall Control the Metaverse?
 
WebGL Primetime!
WebGL Primetime!WebGL Primetime!
WebGL Primetime!
 
Virtually Anywhere
Virtually AnywhereVirtually Anywhere
Virtually Anywhere
 
glTF Update with Tony Parisi WebGL Meetup August 2013
glTF Update with Tony Parisi WebGL Meetup August 2013glTF Update with Tony Parisi WebGL Meetup August 2013
glTF Update with Tony Parisi WebGL Meetup August 2013
 
Artists Only
Artists OnlyArtists Only
Artists Only
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

WebGL, HTML5 and How the Mobile Web Was Won

  • 1. WebGL, HTML5… and how the mobile web was won tony parisi Vizi, inc. march 25, 2014 image: http://www.bitrebels.com
  • 3. … and one platform to rule them all… 3/25/20 14 http://www.tonyparisi.com
  • 4. the web browser as platform fast JavaScript virtual machines hardware-accelerated compositing animation support Workers, WebSockets, local storage, local databases new language initiatives: Dart, Typescript, asm.js mobile-inspired features: location, touch, device orientation… mobile platforms rapidly adopting all HTML5 features in browsers and embedded WebView controls - near-ubiquity 3/25/20 14 http://www.tonyparisi.com
  • 5. breakthrough applications 3/25/20 14 http://www.tonyparisi.comhttp://www.tonyparisi.com ported in 5 days Unreal native C++ engine -> JavaScript Emscripten + asm.js60FPS
  • 6. bringing the power of the GPU to the web WebGL hardware-accelerated 3D rendering CSS 3D hardware-accelerated transforms, transitions, and animations 3/25/20 14 http://www.tonyparisi.com
  • 7. OpenGL ES™ in a browser JavaScript API bindings shipped since early 2011 supported in all modern browsers • desktop Safari, Firefox, Chrome, Opera, Internet Explorer • iOS mobile Safari – iAds only • Android – mobile Chrome, mobile Firefox • Blackberry, Tizen, Firefox OS, Amazon FireOS (Kindle Fire HDX) • Surface (Windows 8.1) • NVIDIA Shield over 1B served http://www.tonyparisi.com 3/25/20 14 the 3D API standard for the web 100,000 Stars Google Experiment http://workshop.chromeexperiments.com/stars/
  • 8. how WebGL works JavaScript API to OpenGL ES (version 2.0) draw to a canvas element using a special context low-level drawing – buffers, primitives, textures and shaders accelerated by graphics hardware (GPU) can draw 2D as well as 3D graphics there is no file format; no markup language; no DOM. http://www.tonyparisi.com 3/25/20 14
  • 9. a simple WebGL program 1. create a <canvas> element 2. obtain a drawing context 3. initialize the viewport 4. create one or more buffers 5. create one or more matrices 6. create one or more shaders 7. initialize the shaders 8. draw one or more primitives http://www.tonyparisi.com 3/25/20 14
  • 10. create the canvas, context and viewport 3/25/20 14 http://www.tonyparisi.com function initWebGL(canvas) { var gl = null; var msg = "Your browser does not support WebGL, " + "or it is not enabled by default."; try { gl = canvas.getContext(“webgl"); } catch (e) { msg = "Error creating WebGL Context!: " + e.toString(); } if (!gl) { alert(msg); throw new Error(msg); } return gl; } function initViewport(gl, canvas) { gl.viewport(0, 0, canvas.width, canvas.height); } detect WebGL set WebGL drawing region
  • 11. buffers and typed arrays var vertexBuffer; vertexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); var verts = [ // Front face -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, // Back face -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, … ]; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW); WebGL drawing functions use buffers of data new low-level data type stores arrays of floats and ints compactly http://www.tonyparisi.com 3/25/20 14
  • 12. shaders var vertexShaderSource = " attribute vec3 vertexPos;n" + " attribute vec2 texCoord;n" + " uniform mat4 modelViewMatrix;n" + " uniform mat4 projectionMatrix;n" + " varying vec2 vTexCoord;n" + " void main(void) {n" + " // Return the transformed and projected vertex valuen" + " gl_Position = projectionMatrix * modelViewMatrix * n" + " vec4(vertexPos, 1.0);n" + " // Output the texture coordinate in vTexCoordn" + " vTexCoord = texCoord;n" + " }n"; var fragmentShaderSource = " precision mediump float;n" + " varying vec2 vTexCoord;n" + " uniform sampler2D uSampler;n" + " void main(void) {n" + " // Return the pixel color: always output whiten" + " gl_FragColor = texture2D(uSampler, vec2(vTexCoord.s, vTexCoord.t));n" + "}n"; the vertex shader transforms model-space positions into screen space the fragment shader outputs a color value for each pixel http://www.tonyparisi.com 3/25/20 14
  • 13. drawingfunction draw(gl, obj) { // clear the background (with black) gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.enable(gl.DEPTH_TEST); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); // set the shader to use gl.useProgram(shaderProgram); // connect up the shader parameters: vertex position, texture coordinate, // projection/model matrices and texture // set up the buffers gl.bindBuffer(gl.ARRAY_BUFFER, obj.buffer); gl.vertexAttribPointer(shaderVertexPositionAttribute, obj.vertSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, obj.texCoordBuffer); gl.vertexAttribPointer(shaderTexCoordAttribute, obj.texCoordSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, obj.indices); gl.uniformMatrix4fv(shaderProjectionMatrixUniform, false, projectionMatrix); gl.uniformMatrix4fv(shaderModelViewMatrixUniform, false, modelViewMatrix); gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, webGLTexture); gl.uniform1i(shaderSamplerUniform, 0); // draw the object gl.drawElements(obj.primtype, obj.nIndices, gl.UNSIGNED_SHORT, 0); } clear the canvas set the shader set up buffers for vertices and texture coordinates pass transform and projection matrices to the shader set the texture and pass to the shader draw the object http://www.tonyparisi.com 3/25/20 14
  • 14. engines and frameworks 3/25/20 14 http://www.tonyparisi.com game engines/IDEs Goo Enginehttp://www.gootechnologies.co m/ Verold http://verold.com/ Turbulenz https://turbulenz.com/ PlayCanvas http://www.playcanvas.com/ Artillery Engine https://artillery.com/ Sketchfab https://sketchfab.com/ Unreal https://www.unrealengine.com/ Unity http://unity3d.com/#unity-5 scene graph libraries/page frameworks Three.js http://threejs.org/ SceneJS http://scenejs.org/ BabylonJS http://www.babylonjs.com/ Vizi https://github.com/tparisi/Vizi Voodoo.js http://www.voodoojs.com/ PhiloGL http://www.senchalabs.org/philogl/ tQuery http://jeromeetienne.github.io/tquery/
  • 15. 3/25/20 14 http://www.tonyparisi.com model from 3drt.com glTF: a “JPEG for 3D” full-featured: scene layout, cameras, lights, animations JSON for scene structure; binary buffers for model data intended for WebGL and OpenGL ES mobile applications
  • 16. CSS3 3D transforms translate, rotate, scale page elements with perspective .bk-list li { perspective: 1800px; } .bk-list li .bk-front { transform-style: preserve-3d; transform-origin: 0% 50%; transform: translate3d(0,0,20px); } .bk-list li .bk-book.bk-bookdefault:hover { transform: rotate3d(0,1,0,35deg); } http://tympanus.net/codrops/2013/01/08 /3d-book-showcase/ browser will render element in 3D perspective add origin to translation apply to child elements apply 35 degree rotation about Y axis http://www.tonyparisi.com 3/25/20 14 even 2D graphics are accelerated if 3D transform functions are used e.g. translate3d(10, 20, 0);
  • 17. winning the mobile 3d web HTML5 runs in all mobile browsers, and as embedded WebView components in apps WebGL is supported in most mobile environments • iOS mobile Safari – iAds only • Android – mobile Chrome, mobile Firefox • Blackberry, Tizen, Firefox OS, Amazon FireOS (Kindle Fire HDX) • Surface (Windows 8.1) • NVIDIA Shield CSS 3D transforms are supported in all mobile environments 3/25/20 14 http://www.tonyparisi.com
  • 18. cross-browser HTML5 and WebGL 3/25/20 14 http://www.tonyparisi.com hybrid app development use CocoonJS™ http://ludei.com/ or Impact Ejecta desktop HTML5 and WebGL all browsers support all features, nearly identically mobile WebGL • iOS - mobile Safari – iAds only • Android – mobile Chrome, Firefox • Amazon Silk, Kindle Fire OS • Blackberry, Tizen, Firefox OS • NVIDIA Shield
  • 19. the tipping point 3/25/20 14 http://www.tonyparisi.com Microsoft now fully supports WebGL in IE and Windows mobile. Kindle Fire HDX: at $229, the 7” is probably the best multimedia device deal on the planet… thanks in part to WebGL. Sony built the whole PS4 user interface out of WebGL. 4.2M seats in one whack… and growing. the 2013 NORAD Tracks Santa site saw 48.8% WebGL success across all browsers & platforms for 20M visitors, an increase of 146% over 2012. Opera Devices SDK – WebGL coming soon to a Bang & Olufsen TV near you! pro game middleware (Unreal, Unity) fully on board CSS 3D transforms are supported on all platforms can Apple be far behind… ?
  • 20. on the frontier… WebGL 2! based on GL ES 3 will contain popular WebGL extensions just getting under way – no dates yet image: http://www.bitrebels.com WebCL Heterogeneous parallel computing JavaScript based on OpenCL 1.1 experimental –browser extensions and custom Chromium builds no ship dates announced yet
  • 21. stay in touch… contact information tparisi@gmail.com skype: auradeluxe http://twitter.com/auradeluxe http://w ww.tonyparisi.com/ http://www.learningwebgl.com/ get the books! WebGL: Up and Running http://www.amazon.com/dp/144932357X Programming 3D Applications with HTML and WebGL http://www.amazon.com/Programming-Applications-HTML5- WebGL-Visualization/dp/1449362966 http://www.tonyparisi.com 3/25/20 14 get Vizi https://github.com/tparisi/Vizi SF WebGL Meetup http://www.meetup.com/WebGL-Developers-Meetup/ book source code https://github.com/tparisi/WebGLBook https://github.com/tparisi/Programming3DApplications