Index: ../trunk-jpl/src/m/plot/plot_unit.js =================================================================== --- ../trunk-jpl/src/m/plot/plot_unit.js (revision 19872) +++ ../trunk-jpl/src/m/plot/plot_unit.js (revision 19873) @@ -53,6 +53,10 @@ node["rotation"] = options.getfieldvalue('view',[0,0,0]); node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)]; node["modelMatrix"] = recalculateModelMatrix(node); + node["alpha"] = options.getfieldvalue('alpha',1.0); + node["overlay"] = true; + node["drawOrder"] = 0; + //some defaults: texcoords.itemSize = 2; Index: ../trunk-jpl/src/m/plot/plot_overlay.js =================================================================== --- ../trunk-jpl/src/m/plot/plot_overlay.js (revision 19872) +++ ../trunk-jpl/src/m/plot/plot_overlay.js (revision 19873) @@ -26,9 +26,12 @@ //}}} //Compute coordinates and data range: - var xlim = options.getfieldvalue('xlim',[ArrayMin(x),ArrayMax(x)]); - var ylim = options.getfieldvalue('ylim',[ArrayMin(y),ArrayMax(y)]); - var zlim = options.getfieldvalue('zlim',[ArrayMin(z),ArrayMax(z)]); + 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]; @@ -45,8 +48,9 @@ node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)]; node["modelMatrix"] = recalculateModelMatrix(node); node["texture"] = initTexture(gl,options.getfieldvalue('image','images/penguin.png')); - node["alpha"] = options.getfieldvalue('alpha',1.0); - node["overlay"] = true; + //node["alpha"] = options.getfieldvalue('alpha',1.0); + node["overlay"] = false; + node["drawOrder"] = 1; //some defaults: texcoords.itemSize = 2; Index: ../trunk-jpl/src/m/plot/plot_mesh.js =================================================================== --- ../trunk-jpl/src/m/plot/plot_mesh.js (revision 19872) +++ ../trunk-jpl/src/m/plot/plot_mesh.js (revision 19873) @@ -42,6 +42,9 @@ node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)]; node["modelMatrix"] = recalculateModelMatrix(node); node["drawMode"] = gl.LINES; + //node["alpha"] = options.getfieldvalue('alpha',1.0); + node["overlay"] = false; + node["drawOrder"] = 0; //some defaults: colors.itemSize = 4; Index: ../trunk-jpl/src/m/plot/webgl.js =================================================================== --- ../trunk-jpl/src/m/plot/webgl.js (revision 19872) +++ ../trunk-jpl/src/m/plot/webgl.js (revision 19873) @@ -120,6 +120,7 @@ modelMatrix:mat4.create(), shaderName:"colored", overlay:false, + drawOrder:0, }; } //}}} function recalculateModelMatrix(node) { //{{{ @@ -368,8 +369,13 @@ window.requestAnimationFrame(function(time) {draw(gl,options,canvas,nodes)}); updateCameraMatrix(canvas); - for (var node in nodes) { - drawSceneGraphNode(gl, canvas, nodes[node]); + var drawPassNumber = 2; + for (var i = drawPassNumber - 1; i >= 0; i--) { + for (var node in nodes) { + if (nodes[node]["drawOrder"] == i) { + drawSceneGraphNode(gl, canvas, nodes[node]); + } + } } } //}}} //}}}