text: /**
   * Created by yangyanjun on 15/9/7.
   */
  
  var VSHADER_SOURCE = document.getElementById('vertex-shader').text;
  var FSHADER_SOURCE = document.getElementById('fragment-shader').text;
  
  function main() {
      var canvas = document.getElementById('webgl');
  
      var gl = getWebGLContext(canvas);
      if (!gl) {
          console.log("获取webGL渲染内容失败");
          return;
      }
  
      if (!initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE)) {
          console.log("Shader初始化失败");
          return;
      }
  
      //设置顶点位置
      var n = initVertexBuffers(gl);
      if (n < 0) {
          console.log('设置顶点位置失败');
          return;
      }
  
      //设置<canvas>的背景色
      gl.clearColor(0.0, 0.0, 0.0, 1.0);
  
      //清空<canvas>
      gl.clear(gl.COLOR_BUFFER_BIT);
  
      //绘制一个点
      gl.drawArrays(gl.POINTS, 0, n);
  }
  
  function initVertexBuffers(gl) {
      var vertices = new Float32Array([
           0.0,  0.5,
          -0.5, -0.5,
           0.5, -0.5
      ]);
      var n = 3; //点的个数为3
  
      //创建缓冲区对象
      var vertexBuffer = gl.createBuffer();
      if (!vertexBuffer) {
          console.log("创建缓冲区对象失败");
          return -1;
      }
  
      //将缓冲区对象绑定到目标
      gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
  
      //向缓冲区对象中写入数据
      gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
  
      var a_Position = gl.getAttribLocation(gl.program, 'a_Position');
      if (a_Position < 0) {
          console.log('获取a_Position失败');
          return -1;
      }
  
      //将缓冲区对象分配给a_Position对象
      gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 0, 0);
  
      //链接a_Position变量与分配给它的缓冲区对象
      gl.enableVertexAttribArray(a_Position);
  
      return n;
  }