separate webgl capability detector in main.js, keep track

10.3.x-maintenance
cTn 2014-10-02 11:21:56 +02:00
parent c60596d79c
commit 840058d4c1
2 changed files with 15 additions and 1 deletions

10
main.js
View File

@ -40,6 +40,16 @@ $(document).ready(function () {
GUI.log('You\'re using an old version of ' + chrome.runtime.getManifest().name + '. Please update so you can benefit from recently added features and bugfixes.');
}
// log webgl capability
// it would seem the webgl "enabling" through advanced settings will be ignored in the future
// and webgl will be supported if gpu supports it by default (canary 40.0.2175.0), keep an eye on this one
var canvas = document.createElement('canvas');
if (window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl'))) {
googleAnalytics.sendEvent('Capability', 'WebGL', 'true');
} else {
googleAnalytics.sendEvent('Capability', 'WebGL', 'false');
}
// log library versions in console to make version tracking easier
console.log('Libraries: jQuery - ' + $.fn.jquery + ', d3 - ' + d3.version + ', three.js - ' + THREE.REVISION);

View File

@ -317,7 +317,11 @@ TABS.setup.initialize3D = function (compatibility) {
wrapper = $('.CAP_BASEFLIGHT_CONFIG #canvas_wrapper');
}
if (window.WebGLRenderingContext && (canvas.get(0).getContext('webgl') || canvas.get(0).getContext('experimental-webgl'))) {
// webgl capability detector
// it would seem the webgl "enabling" through advanced settings will be ignored in the future
// and webgl will be supported if gpu supports it by default (canary 40.0.2175.0), keep an eye on this one
var detector_canvas = document.createElement('canvas');
if (window.WebGLRenderingContext && (detector_canvas.getContext('webgl') || detector_canvas.getContext('experimental-webgl'))) {
renderer = new THREE.WebGLRenderer({canvas: canvas.get(0), alpha: true, antialias: true});
} else {
renderer = new THREE.CanvasRenderer({canvas: canvas.get(0), alpha: true});