diff --git a/html/planeObject.js b/html/planeObject.js
index 35b2e3e..225f155 100644
--- a/html/planeObject.js
+++ b/html/planeObject.js
@@ -1332,7 +1332,7 @@ PlaneObject.prototype.updatePositionData = function(now, last, data, init) {
if (this.position && SitePosition) {
if (pTracks && this.sitedist) {
this.sitedist = Math.max(ol.sphere.getDistance(SitePosition, this.position), this.sitedist);
- } else {
+ } else if (!init) {
this.sitedist = ol.sphere.getDistance(SitePosition, this.position);
}
}
diff --git a/html/script.js b/html/script.js
index 29b5697..85b61bd 100644
--- a/html/script.js
+++ b/html/script.js
@@ -2148,16 +2148,26 @@ function webglAddLayer() {
style: glStyle,
renderBuffer: renderBuffer,
});
- if (!webglLayer || !webglLayer.getRenderer())
+ if (!webglLayer)
return false;
+ if (loStore['webglTested'] != 'true' && !webglLayer.getRenderer()) {
+ return false;
+ }
layers.push(webglLayer);
webgl = true;
- plane.visible = true;
- plane.updateMarker();
- OLMap.renderSync();
+ // only test webgl once in every browser
+ // after that assume that it's working
+
+ if (loStore['webglTested'] != 'true') {
+ plane.visible = true;
+ plane.updateMarker();
+ OLMap.renderSync();
+ }
+
+ loStore['webglTested'] = 'true';
success = true;
} catch (error) {
try {