Changeset 19727


Ignore:
Timestamp:
11/16/15 16:55:06 (9 years ago)
Author:
Eric.Larour
Message:

CHG: shuffling the code order.

Location:
issm/trunk-jpl/src/m/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_unit.js

    r19724 r19727  
    99        //edgecolor
    1010        edgecolor=options.getfieldvalue('edgecolor','none');
     11       
     12        /*First initialize webgl for the corresponding canvas: */
     13        var canvas=document.getElementById(options.getfieldvalue('canvasid'));
     14
     15        //Initialize the GL context:
     16        var gl=initWebGL(canvas);
     17
     18        // Only continue if WebGL is available and working
     19
     20        if (gl) {
     21                // Set clear color to black, fully opaque
     22                gl.clearColor(0.0, 0.0, 0.0, 1.0);
     23                // Enable depth testing
     24                gl.enable(gl.DEPTH_TEST);
     25                // Near things obscure far things
     26                gl.depthFunc(gl.LEQUAL);
     27                // Clear the color as well as the depth buffer.
     28                gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
     29        }
    1130
    1231        switch(datatype){
     
    4261                case 2:
    4362
    44                        
    45 
    4663                        if (elements[0].length==6){ //prisms
    4764                                /*A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
     
    6077                        }
    6178                        else{
    62                                
    63                                 var canvas=document.getElementById(options.getfieldvalue('canvasid'));
    64 
    65                                 //Initialize the GL context:
    66                                 var gl=initWebGL(canvas);
    67 
    68                                 // Only continue if WebGL is available and working
    69 
    70                                 if (gl) {
    71                                         // Set clear color to black, fully opaque
    72                                         gl.clearColor(0.0, 0.0, 0.0, 1.0);
    73                                         // Enable depth testing
    74                                         gl.enable(gl.DEPTH_TEST);
    75                                         // Near things obscure far things
    76                                         gl.depthFunc(gl.LEQUAL);
    77                                         // Clear the color as well as the depth buffer.
    78                                         gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    79                                 }
    8079                               
    8180                                /*A=elements(:,1); B=elements(:,2); C=elements(:,3);
  • issm/trunk-jpl/src/m/plot/webgl.js

    r19726 r19727  
    1 function initWebGL(canvas) {
     1/*This is where we have all our webgl relevant functionality for the plotting routines: */
     2function initWebGL(canvas) { //{{{
    23        gl = null;
    34
     
    1516
    1617        return gl;
    17 }
     18} //}}}
Note: See TracChangeset for help on using the changeset viewer.