SlideShare une entreprise Scribd logo
1  sur  37
Télécharger pour lire hors ligne
HTML5 Meetup XIII
Build HTML5/WebGL applications with C++ and ASM.js

Jean-Marc Le Roux
CEO and co-founder of Aerys
jeanmarc@aerys.in
@promethe42
by
3D. Everywhere.
Deliver engaging, interactive and rich 3D content and applications on
desktops, mobiles and the web.
Augment your processes.
Minko « Entreprise » Edition

W

Share massive 3D files on the cloud thanks to Minko’s exclusive
3D compression and streaming algorithms. Go mobile, integrate your
3D content in documents and work in augmented reality.
Focus on design. Boost with code.
Minko « Studio » Edition
Designers integrate 3D content, customize materials, setup lights and animations.
Developers plug in scripts and interactivity.
The sky is the limit.
Minko « Community » Edition

Build desktop, web and mobile 3D applications with
Minko’s free and open source SDK including
a fully-featured 3D engine and plugins.
Why?

Motivations to build WebGL apps with C++
3D apps tends to be more complex
 3D apps are usually bigger projects
 Bigger teams
 Bigger expectations

 C++ is more expressive (but more complex)
 Reuse existing C++ libraries
3D apps require more performances
 GPU programming, 3D maths, 3D physics, 3D AI, Massive
files loading
 Javascript suffers from its dynamic nature
 Dynamic typing
 Dynamic execution
WebGL VS Stage3D - Penetration Rate
WebGL

Flash

53%
96%

Firefox 4+, Chrome 9+, IE11

Any browser with Flash 11+
Source: Statcounter
WebGL VS Stage3D – HW Compatibility
WebGL

Flash

?
96% *

* 2006 and newer hardware, software fallback otherwise
WebGL => Flash Fallback!
 Start working with standards today, but keep adressing the largest audience possible

Is WebGL
available?

yes
Run WebGL/JS app.

no

Run Flash app.
Target native platforms

 Android, iOS, Windows, Mac, Linux, Tizen
 Embedding a JS/HTML5/WebGL app in a web view would work but
– Would be very slow
– Cumbersome to develop/deploy/debug
How?

Workflow & tools
C++ 2011

 Standard, fast, well documented and supported by a vast community
 Already fully supported by all major compilers (VS, GCC, LLVM…)
 New additions make it closer to what we’re used to with AS3/Javascript
– Closures/lambda functions
– Type inference (instead of dynamic typing)
– Shared pointers
Emscripten https://github.com/kripken/emscripten
 Open source project driven by Mozilla

– Based on LLVM, which is supported by Google, Apple, Intel and many more

 Cross-compile C++ code to Javascript code
– Binds OpenGL to WebGL
– Provide virtual file system
– C++  Javascript bindings

 Code optimizations

– Closure compiler
– asm.js (2x performances of native code!)

 Code compression using LZMA
AbstractContext
 Mimics flash.display3D.Context3D interface
– Leverages Adobe’s work on wrapping DirectX/OpenGL
– Mainly uses simple native types (int, float…) to make it easier to wrap/bind in multiple
languages

 Defines all you need to work with OpenGL ES 2-compliant APIs
– Enforces compatibility
– Can be extended to provide more « custom » capabilities if you want

AbstractContext

OpenGLES2Context

WebGLContext
OpenGLES2Context
 Extends AbstractContext
 Implement all required methods using the OpenGL API


Actually uses OpenGL bindings, but limited only to what is actually available in OpenGL ES 2
– Should work out of the box with any OpenGL ES 2 compliant implementation
– But also on any OpenGL implementation (ex: Windows, Mac and Linux)

AbstractContext

OpenGLES2Context

WebGLContext
WebGLContext
 Extends OpenGLES2Context
– Actually inherits more than 95% of its code

 Override a few methods to handle some minor WebGL quirks
– Some methods do not work properly/exist and have to be wrapped using (simple)
workarounds

AbstractContext

OpenGLES2Context

WebGLContext
Compilation – em++

C++ app. code

LLVM
Optimizations

App. object file
Compilation – em++
C++ app. code
Minko Sources

Minko

Core framework C++ code
C++ 2011
code

App. object file

Core framework static library

Plugins C++ Code

Plugins Static Libraries

Physics

Physics

Particles

Particles

JPEG Parser

JPEG Parser

PNG Parser

PNG Parser

MK Parser

MK Parser

ASM.js
Javascript code
Linkage - emar
App. object file
Minko

Core framework static library
Plugins Static Libraries

Physics
Particles
JPEG Parser
PNG Parser
MK Parser

application.js
Optimization

application.js

application_optimized.js



Closure compiler
LZMA compression
ASM.js
 Research project from Mozilla

 Now enabled by default since Firefox 22

 Subset of Javascript

 Fully retro-compatible with all JS compilers/engines

 Designed for performances

 Low-level & compiler compliant syntax
 Emscripten now outputs ASM.js code by default
ASM.js - Example
function strlen(ptr) {
// calculate length of C string
ptr = ptr | 0;
var curr = 0;
curr = ptr;
while (MEM8[curr] | 0 != 0)
{
curr = (curr + 1) | 0;
}
return (curr - ptr) | 0;
}

 Ensure that ptr is always an
integer
 Read an integer from
address curr
 Additions and subtractions
are all 32 bits
ASM.js – Micro-Benchmarks

Source: http://kripken.github.io/mloc_emscripten_talk/#/27
ASM.js – Realistic Benchmarks

Source: http://kripken.github.io/mloc_emscripten_talk/#/28
http://minko.io/showcase/sponza-html5

EXAMPLE: SPONZA HTML5!
Bonus
Premake http://industriousone.com/premake
 Cross-platform build system

 Windows, Mac and Linux
 Reference in the video game industry
 Well documented

 Compatible with most IDEs/tools
 gmake
 Visual Studio
 XCode

 Easy to extend and customize
 Based on LUA script configuration files
 Adding support for emscripten was easy
Vagrant http://www.vagrantup.com/
 Goal: easily cross-compile without installing/configuring
complicated stuff
 Virtualized build environment

 Based on VirtualBox
 Will install and bootstrap everything for you
 Will auto-update itself to make sure you always use the latest stable toolchain

 We provide the configuration file to compile to HTML5/WebGL in just
a single command line!
 Ubuntu virtual machine
 Uses Premake4 + gmake
 Will do the same for Flash/Crossbridge
Conclusion
My Feedback – The Good Parts
 Working with C++ 2011 is amazing

 More complex but so much powerful/expressive than AS3/JS
 Useful and reliable STL containers (list, maps, sets, etc…)
 Shared pointers make memory management just as easy as with managed
languages: not a single memory leak so far!

 Visual Studio/XCode are very good IDEs
 Minko 3’s implementation is much lighter and yet just as much
powerful
 Vagrant + Premake provides an efficient build system with crosscompilation
My Feedback – The Good Parts
 Compatibility

 The app runs on Windows, Mac, Linux and WebGL withouth a single modification!
 Haven’t tested iOS/Android yet, but should work out of the box

 Binary size

 Closure compiler will make the binary 2 to 3x lighter
 LZMA compression will make the binary 5 to 6x lighter
 Combine both to get a final binary even lighter than the native one!

 Speed

 2x speed of native code thanks to asm.js!
 Possiblity much faster than an AS3 implementation

 Integration

 Emscripten « modules » system make it easy to generate a *.js file and run it in any web page
My Feedback – The Bad Parts
 Workflow

 Haven’t figured out how to make dynamic libraries for now

 Speed

 WebGL API is the bottleneck 

 Memory consumption

 256MB of required memory seems excessive (I haven’t make a comparison
with AS3 so far though…)

 I miss the Flash API

 How do to a 2D UI using HTML5 comps?
 URLRequest?
Conclusion
 C++ 2011 is very efficient to build interactive and rich apps
 Emscripten is mature enough to start working on largescale applications
 Using #ifdef for portability of C++ code is a bit
cumbersome
 But it can easily be fixed by wrapping the app. init
Don’t forget to check http://minko.io !

Merci !

Contenu connexe

Tendances

Basics of Node.js
Basics of Node.jsBasics of Node.js
Basics of Node.jsAlper Unal
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientMayflower GmbH
 
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVMSHASHI KUMAR
 
Open API (aka Swagger) - DDD by Night May 2020
Open API (aka Swagger) - DDD by Night May 2020Open API (aka Swagger) - DDD by Night May 2020
Open API (aka Swagger) - DDD by Night May 2020Pratik Khasnabis
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMOwais Zahid
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Return on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataReturn on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataMSDEVMTL
 
Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...Pôle Systematic Paris-Region
 
Offscreen canvas 2021 update
Offscreen canvas 2021 updateOffscreen canvas 2021 update
Offscreen canvas 2021 updateIgalia
 
What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0Jon Galloway
 
Migrating .NET Application to .NET Core
Migrating .NET Application to .NET CoreMigrating .NET Application to .NET Core
Migrating .NET Application to .NET CoreBaris Ceviz
 
Onivim: Modal Editing from the Future
Onivim: Modal Editing from the FutureOnivim: Modal Editing from the Future
Onivim: Modal Editing from the FutureBryan Phelps
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemendian7000
 

Tendances (20)

Basics of Node.js
Basics of Node.jsBasics of Node.js
Basics of Node.js
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native Client
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in Kotlin
 
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVM
 
Whats new in .net core 3
Whats new in .net core 3Whats new in .net core 3
Whats new in .net core 3
 
Open API (aka Swagger) - DDD by Night May 2020
Open API (aka Swagger) - DDD by Night May 2020Open API (aka Swagger) - DDD by Night May 2020
Open API (aka Swagger) - DDD by Night May 2020
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
 
Node js with steroids
Node js with steroidsNode js with steroids
Node js with steroids
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
HaXe Demo
HaXe DemoHaXe Demo
HaXe Demo
 
WebAssemlby vs JavaScript
WebAssemlby vs JavaScriptWebAssemlby vs JavaScript
WebAssemlby vs JavaScript
 
Return on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataReturn on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & Data
 
Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...
 
Wasm intro
Wasm introWasm intro
Wasm intro
 
Offscreen canvas 2021 update
Offscreen canvas 2021 updateOffscreen canvas 2021 update
Offscreen canvas 2021 update
 
What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0
 
Migrating .NET Application to .NET Core
Migrating .NET Application to .NET CoreMigrating .NET Application to .NET Core
Migrating .NET Application to .NET Core
 
Onivim: Modal Editing from the Future
Onivim: Modal Editing from the FutureOnivim: Modal Editing from the Future
Onivim: Modal Editing from the Future
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
 
GraalVM
GraalVMGraalVM
GraalVM
 

Similaire à Minko - Build WebGL applications with C++ and asm.js

WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014Minko3D
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko3D
 
Minko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko3D
 
Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Minko3D
 
Minko - Flash Conference #5
Minko - Flash Conference #5Minko - Flash Conference #5
Minko - Flash Conference #5Minko3D
 
Paris Android LiveCode - Creating cross-platform 3D apps with Minko
Paris Android LiveCode - Creating cross-platform 3D apps with MinkoParis Android LiveCode - Creating cross-platform 3D apps with Minko
Paris Android LiveCode - Creating cross-platform 3D apps with MinkoMinko3D
 
Minko - Creating cross-platform 3D apps with Minko
Minko - Creating cross-platform 3D apps with MinkoMinko - Creating cross-platform 3D apps with Minko
Minko - Creating cross-platform 3D apps with MinkoMinko3D
 
Minko - Scripting 3D apps with Lua and C++
Minko - Scripting 3D apps with Lua and C++Minko - Scripting 3D apps with Lua and C++
Minko - Scripting 3D apps with Lua and C++Minko3D
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222Minko3D
 
Minko - Why we created our own Flash platform and why you should care
Minko - Why we created our own Flash platform and why you should careMinko - Why we created our own Flash platform and why you should care
Minko - Why we created our own Flash platform and why you should careMinko3D
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceIntel® Software
 
Selenium Training in Amritsar
Selenium Training in AmritsarSelenium Training in Amritsar
Selenium Training in AmritsarE2MATRIX
 
Selenium Training in Chandigarh
Selenium Training in ChandigarhSelenium Training in Chandigarh
Selenium Training in ChandigarhE2MATRIX
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworksnawal saad
 
What's New in ASP.NET Core 3
What's New in ASP.NET Core 3What's New in ASP.NET Core 3
What's New in ASP.NET Core 3Andrea Dottor
 
Selenium Training in Jalandhar
Selenium Training in JalandharSelenium Training in Jalandhar
Selenium Training in JalandharE2MATRIX
 
Selenium Training in Ludhiana
Selenium Training in LudhianaSelenium Training in Ludhiana
Selenium Training in LudhianaE2MATRIX
 
Selenium Training in Mohali
Selenium Training in MohaliSelenium Training in Mohali
Selenium Training in MohaliE2MATRIX
 

Similaire à Minko - Build WebGL applications with C++ and asm.js (20)

WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013
 
Minko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSL
 
Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...
 
Minko - Flash Conference #5
Minko - Flash Conference #5Minko - Flash Conference #5
Minko - Flash Conference #5
 
Paris Android LiveCode - Creating cross-platform 3D apps with Minko
Paris Android LiveCode - Creating cross-platform 3D apps with MinkoParis Android LiveCode - Creating cross-platform 3D apps with Minko
Paris Android LiveCode - Creating cross-platform 3D apps with Minko
 
Minko - Creating cross-platform 3D apps with Minko
Minko - Creating cross-platform 3D apps with MinkoMinko - Creating cross-platform 3D apps with Minko
Minko - Creating cross-platform 3D apps with Minko
 
Minko - Scripting 3D apps with Lua and C++
Minko - Scripting 3D apps with Lua and C++Minko - Scripting 3D apps with Lua and C++
Minko - Scripting 3D apps with Lua and C++
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222
 
Build 2019 Recap
Build 2019 RecapBuild 2019 Recap
Build 2019 Recap
 
Minko - Why we created our own Flash platform and why you should care
Minko - Why we created our own Flash platform and why you should careMinko - Why we created our own Flash platform and why you should care
Minko - Why we created our own Flash platform and why you should care
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript Performance
 
Selenium Training in Amritsar
Selenium Training in AmritsarSelenium Training in Amritsar
Selenium Training in Amritsar
 
Selenium Training in Chandigarh
Selenium Training in ChandigarhSelenium Training in Chandigarh
Selenium Training in Chandigarh
 
Where should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and moreWhere should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and more
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
What's New in ASP.NET Core 3
What's New in ASP.NET Core 3What's New in ASP.NET Core 3
What's New in ASP.NET Core 3
 
Selenium Training in Jalandhar
Selenium Training in JalandharSelenium Training in Jalandhar
Selenium Training in Jalandhar
 
Selenium Training in Ludhiana
Selenium Training in LudhianaSelenium Training in Ludhiana
Selenium Training in Ludhiana
 
Selenium Training in Mohali
Selenium Training in MohaliSelenium Training in Mohali
Selenium Training in Mohali
 

Dernier

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.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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 2024The Digital Insurer
 
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 WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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 DevelopmentsTrustArc
 
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 slidevu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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 Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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...Miguel Araújo
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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 RobisonAnna Loughnan Colquhoun
 
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 2024The Digital Insurer
 
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 BusinessPixlogix Infotech
 
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.pptxMalak Abu Hammad
 

Dernier (20)

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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
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
 
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 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
 

Minko - Build WebGL applications with C++ and asm.js

  • 1. HTML5 Meetup XIII Build HTML5/WebGL applications with C++ and ASM.js Jean-Marc Le Roux CEO and co-founder of Aerys jeanmarc@aerys.in @promethe42
  • 2. by
  • 3. 3D. Everywhere. Deliver engaging, interactive and rich 3D content and applications on desktops, mobiles and the web.
  • 4. Augment your processes. Minko « Entreprise » Edition W Share massive 3D files on the cloud thanks to Minko’s exclusive 3D compression and streaming algorithms. Go mobile, integrate your 3D content in documents and work in augmented reality.
  • 5. Focus on design. Boost with code. Minko « Studio » Edition Designers integrate 3D content, customize materials, setup lights and animations. Developers plug in scripts and interactivity.
  • 6. The sky is the limit. Minko « Community » Edition Build desktop, web and mobile 3D applications with Minko’s free and open source SDK including a fully-featured 3D engine and plugins.
  • 7. Why? Motivations to build WebGL apps with C++
  • 8. 3D apps tends to be more complex  3D apps are usually bigger projects  Bigger teams  Bigger expectations  C++ is more expressive (but more complex)  Reuse existing C++ libraries
  • 9. 3D apps require more performances  GPU programming, 3D maths, 3D physics, 3D AI, Massive files loading  Javascript suffers from its dynamic nature  Dynamic typing  Dynamic execution
  • 10. WebGL VS Stage3D - Penetration Rate WebGL Flash 53% 96% Firefox 4+, Chrome 9+, IE11 Any browser with Flash 11+ Source: Statcounter
  • 11. WebGL VS Stage3D – HW Compatibility WebGL Flash ? 96% * * 2006 and newer hardware, software fallback otherwise
  • 12. WebGL => Flash Fallback!  Start working with standards today, but keep adressing the largest audience possible Is WebGL available? yes Run WebGL/JS app. no Run Flash app.
  • 13. Target native platforms  Android, iOS, Windows, Mac, Linux, Tizen  Embedding a JS/HTML5/WebGL app in a web view would work but – Would be very slow – Cumbersome to develop/deploy/debug
  • 15. C++ 2011  Standard, fast, well documented and supported by a vast community  Already fully supported by all major compilers (VS, GCC, LLVM…)  New additions make it closer to what we’re used to with AS3/Javascript – Closures/lambda functions – Type inference (instead of dynamic typing) – Shared pointers
  • 16. Emscripten https://github.com/kripken/emscripten  Open source project driven by Mozilla – Based on LLVM, which is supported by Google, Apple, Intel and many more  Cross-compile C++ code to Javascript code – Binds OpenGL to WebGL – Provide virtual file system – C++  Javascript bindings  Code optimizations – Closure compiler – asm.js (2x performances of native code!)  Code compression using LZMA
  • 17. AbstractContext  Mimics flash.display3D.Context3D interface – Leverages Adobe’s work on wrapping DirectX/OpenGL – Mainly uses simple native types (int, float…) to make it easier to wrap/bind in multiple languages  Defines all you need to work with OpenGL ES 2-compliant APIs – Enforces compatibility – Can be extended to provide more « custom » capabilities if you want AbstractContext OpenGLES2Context WebGLContext
  • 18. OpenGLES2Context  Extends AbstractContext  Implement all required methods using the OpenGL API  Actually uses OpenGL bindings, but limited only to what is actually available in OpenGL ES 2 – Should work out of the box with any OpenGL ES 2 compliant implementation – But also on any OpenGL implementation (ex: Windows, Mac and Linux) AbstractContext OpenGLES2Context WebGLContext
  • 19. WebGLContext  Extends OpenGLES2Context – Actually inherits more than 95% of its code  Override a few methods to handle some minor WebGL quirks – Some methods do not work properly/exist and have to be wrapped using (simple) workarounds AbstractContext OpenGLES2Context WebGLContext
  • 20. Compilation – em++ C++ app. code LLVM Optimizations App. object file
  • 21. Compilation – em++ C++ app. code Minko Sources Minko Core framework C++ code C++ 2011 code App. object file Core framework static library Plugins C++ Code Plugins Static Libraries Physics Physics Particles Particles JPEG Parser JPEG Parser PNG Parser PNG Parser MK Parser MK Parser ASM.js Javascript code
  • 22. Linkage - emar App. object file Minko Core framework static library Plugins Static Libraries Physics Particles JPEG Parser PNG Parser MK Parser application.js
  • 24. ASM.js  Research project from Mozilla  Now enabled by default since Firefox 22  Subset of Javascript  Fully retro-compatible with all JS compilers/engines  Designed for performances  Low-level & compiler compliant syntax  Emscripten now outputs ASM.js code by default
  • 25. ASM.js - Example function strlen(ptr) { // calculate length of C string ptr = ptr | 0; var curr = 0; curr = ptr; while (MEM8[curr] | 0 != 0) { curr = (curr + 1) | 0; } return (curr - ptr) | 0; }  Ensure that ptr is always an integer  Read an integer from address curr  Additions and subtractions are all 32 bits
  • 26. ASM.js – Micro-Benchmarks Source: http://kripken.github.io/mloc_emscripten_talk/#/27
  • 27. ASM.js – Realistic Benchmarks Source: http://kripken.github.io/mloc_emscripten_talk/#/28
  • 29. Bonus
  • 30. Premake http://industriousone.com/premake  Cross-platform build system  Windows, Mac and Linux  Reference in the video game industry  Well documented  Compatible with most IDEs/tools  gmake  Visual Studio  XCode  Easy to extend and customize  Based on LUA script configuration files  Adding support for emscripten was easy
  • 31. Vagrant http://www.vagrantup.com/  Goal: easily cross-compile without installing/configuring complicated stuff  Virtualized build environment  Based on VirtualBox  Will install and bootstrap everything for you  Will auto-update itself to make sure you always use the latest stable toolchain  We provide the configuration file to compile to HTML5/WebGL in just a single command line!  Ubuntu virtual machine  Uses Premake4 + gmake  Will do the same for Flash/Crossbridge
  • 33. My Feedback – The Good Parts  Working with C++ 2011 is amazing  More complex but so much powerful/expressive than AS3/JS  Useful and reliable STL containers (list, maps, sets, etc…)  Shared pointers make memory management just as easy as with managed languages: not a single memory leak so far!  Visual Studio/XCode are very good IDEs  Minko 3’s implementation is much lighter and yet just as much powerful  Vagrant + Premake provides an efficient build system with crosscompilation
  • 34. My Feedback – The Good Parts  Compatibility  The app runs on Windows, Mac, Linux and WebGL withouth a single modification!  Haven’t tested iOS/Android yet, but should work out of the box  Binary size  Closure compiler will make the binary 2 to 3x lighter  LZMA compression will make the binary 5 to 6x lighter  Combine both to get a final binary even lighter than the native one!  Speed  2x speed of native code thanks to asm.js!  Possiblity much faster than an AS3 implementation  Integration  Emscripten « modules » system make it easy to generate a *.js file and run it in any web page
  • 35. My Feedback – The Bad Parts  Workflow  Haven’t figured out how to make dynamic libraries for now  Speed  WebGL API is the bottleneck   Memory consumption  256MB of required memory seems excessive (I haven’t make a comparison with AS3 so far though…)  I miss the Flash API  How do to a 2D UI using HTML5 comps?  URLRequest?
  • 36. Conclusion  C++ 2011 is very efficient to build interactive and rich apps  Emscripten is mature enough to start working on largescale applications  Using #ifdef for portability of C++ code is a bit cumbersome  But it can easily be fixed by wrapping the app. init
  • 37. Don’t forget to check http://minko.io ! Merci !