Index: /issm/trunk-jpl/src/m/plot/webgl.js
===================================================================
--- /issm/trunk-jpl/src/m/plot/webgl.js	(revision 19921)
+++ /issm/trunk-jpl/src/m/plot/webgl.js	(revision 19922)
@@ -15,5 +15,5 @@
 		gl = null;
 	}
-
+		
 	// Enable depth testing
 	gl.enable(gl.DEPTH_TEST);
@@ -31,4 +31,6 @@
 	// Load shaders and store them in gl object
 	gl.shaders = loadShaders(gl);
+	
+
 
 	// Add context state variables
@@ -38,9 +40,9 @@
 	canvas.zoomLast = canvas.zoomFactor;
 	canvas.cameraMatrix = mat4.create();
-	canvas.translation = [0,0,options.getfieldvalue('centeroffset',0.25)];
+	canvas.translation = options.getfieldvalue('centeroffset',[0,0,0.25]);
 	canvas.rotationAzimuthBounds = options.getfieldvalue('azimuthbounds',[0,360]);
 	canvas.rotationElevationBounds = options.getfieldvalue('elevationbounds',[-180,180]);
 	canvas.rotationDefault = options.getfieldvalue('view',[0,90]); //0 azimuth - up is north, 90 elevation - looking straight down
-	canvas.rotation = queryView(canvas);
+	canvas.rotation = canvas.rotationDefault;
 	canvas.controlsensitivity = 1;
 
@@ -163,9 +165,17 @@
 	return Math.max(min, Math.min(value, max));
 } //}}}
-function queryView(canvas) { //{{{
-	if (canvas.rotation) {
+function recoverview(canvasid,defaultview) { //{{{
+	var canvas  = document.getElementById(canvasid);
+	if (canvas && canvas.hasOwnProperty("rotation")) {
 		return canvas.rotation;
 	}
-	return canvas.rotationDefault;
+	return defaultview;
+} //}}}
+function recovercenteroffset(canvasid,defaultcenter) { //{{{
+	var canvas  = document.getElementById(canvasid);
+	if (canvas && canvas.hasOwnProperty("translation")) {
+		return canvas.translation;
+	}
+	return defaultcenter;
 } //}}}
 //}}}
@@ -441,4 +451,13 @@
 } //}}}
 function draw(gl,options,canvas,nodes) { //{{{
+	// Ensure canvas and gl viewport sizes are the same
+	var displayWidth  = canvas.clientWidth;
+	var displayHeight = canvas.clientHeight;
+	if (canvas.width  != displayWidth || canvas.height != displayHeight) {
+		canvas.width  = displayWidth;
+		canvas.height = displayHeight;
+		gl.viewport(0, 0, canvas.width, canvas.height);
+	}
+	
 	// Set clear color to black, fully opaque
 	var backgroundcolor=new RGBColor(options.getfieldvalue('backgroundcolor','lightcyan'));
@@ -457,4 +476,5 @@
 	// Else, clear the color as well as the depth buffer for new frame
 	gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
 	window.requestAnimationFrame(function(time) {draw(gl,options,canvas,nodes)});
 	
