Index: /issm/trunk-jpl/src/m/plot/plot_overlay.js
===================================================================
--- /issm/trunk-jpl/src/m/plot/plot_overlay.js	(revision 19866)
+++ /issm/trunk-jpl/src/m/plot/plot_overlay.js	(revision 19867)
@@ -17,19 +17,26 @@
 	
 	//Process data and model
-	var x = md.mesh.x;
-	var y = md.mesh.y;
-	var z = [0.0];
-	var elements = md.mesh.elements;
+	var meshresults = processmesh(md,data,options);
+	var x = meshresults[0]; 
+	var y = meshresults[1]; 
+	var z = meshresults[2]; 
+	var elements = meshresults[3]; 
+	var is2d = meshresults[4]; 
+	var isplanet = meshresults[5];
 	//}}}
 
 	//Compute coordinates and data range:
-	xlim=options.getfieldvalue('xlim',[ArrayMin(x),ArrayMax(x)]);
-	ylim=options.getfieldvalue('ylim',[ArrayMin(y),ArrayMax(y)]);
+	var modelxlim = [ArrayMin(x),ArrayMax(x)];
+	var modelylim = [ArrayMin(y),ArrayMax(y)];
+	var modelzlim = [ArrayMin(z),ArrayMax(z)];
+	var xlim = options.getfieldvalue('xlim',modelxlim);
+	var ylim = options.getfieldvalue('ylim',modelylim);
+	var zlim = options.getfieldvalue('zlim',modelzlim);
 	xmin = xlim[0];
 	xmax = xlim[1];
 	ymin = ylim[0];
 	ymax = ylim[1];
-	zmin = ArrayMin(z);
-	zmax = ArrayMax(z);
+	zmin = zlim[0];
+	zmax = zlim[1];
 	
 	//Compute scaling: 
@@ -37,7 +44,7 @@
 	node["scale"] = [scale, scale, scale];
 	node["rotation"] = options.getfieldvalue('view',[0,0,0]);
-	node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)];
+	node["translation"] = [(modelxlim[0] + modelxlim[1]) / (-2 / scale), (modelylim[0] + modelylim[1]) / (-2 / scale), (modelzlim[0] + modelzlim[1]) / (-2 / scale)];
 	node["modelMatrix"] = recalculateModelMatrix(node);
-	node["texture"] = initTexture(gl,options.getfieldvalue('image','images/checker.gif'));
+	node["texture"] = initTexture(gl,options.getfieldvalue('image','images/penguin.png'));
 	node["alpha"] = options.getfieldvalue('alpha',1.0);
 	node["overlay"] = true;
@@ -49,4 +56,10 @@
 	var xrange = xmax - xmin;
 	var yrange = ymax - ymin;
+
+	//redefine overlay as square plane
+	x = [xmin, xmax, xmin, xmax];
+	y = [ymin, ymin, ymax, ymax];
+	z = [zmin, zmin, zmin, zmin];
+	elements = [[1,2,3],[2,4,3]];
 	
 	//generate mesh:
@@ -54,5 +67,5 @@
 		vertices[vertices.length] = x[i];
 		vertices[vertices.length] = y[i];
-		vertices[vertices.length] = 0.0;
+		vertices[vertices.length] = z[i];
 
 		texcoords[texcoords.length] = (x[i] - xmin) / xrange;
