this.errorInitWebGL = false;
try {
- this.testBenchmark(function () {
- $this.init();
- });
+ this.init();
} catch (e) {
this.errorInitWebGL = true;
this.init();
return !this.errorInitWebGL && this.fluidbook.support.IE === 0 && Modernizr.webgl;
},
- testBenchmark: function (cb) {
- // IE doesn't need benchmark test, it's always treated as very low perf (
- if (!this.webglEnabled()) {
- cb();
- }
- var $this = this;
- try {
- var canvas = $this.jcontainer.find('canvas').get(0);
- var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
- var debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
- var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
-
- if (this.fluidbook.settings.gupsc[renderer] !== undefined && this.fluidbook.settings.gupsc[renderer] !== null) {
- this.benchmark = this.fluidbook.settings.gupsc[renderer];
- cb();
- } else {
- $.ajax({
- url: "https://workshop.fluidbook.com/services/gup",
- dataType: 'json',
- data: {gup: btoa(renderer)},
- success: function (data) {
- $this.benchmark = parseInt(data);
- cb();
- },
- error: function () {
- cb();
- }
- });
- }
- } catch (e) {
- console.log(e);
- cb();
- }
- },
-
init: function () {
var $this = this;