title: How to draw a line in p5.js using WEBGL
body: <p>Does drawing lines in 3D work in p5.js?</p>
  
  <p>The tutorial here: 
  <a href="https://github.com/processing/p5.js/wiki/Getting-started-with-WebGL-in-p5" rel="nofollow noreferrer">https://github.com/processing/p5.js/wiki/Getting-started-with-WebGL-in-p5</a>
  says that it should, but my attempt just gives a blank page.</p>
  
  <pre><code>function setup() {
    createCanvas(400,400, WEBGL);
  }
  
  function draw(){
    line(-100,-100,-100, 100,100,100);
  }
  </code></pre>
  
  <p>As Kevin, below, has pointed out, the console gives an error:</p>
  
  <pre><code>TypeError: this._renderer.line is not a function
  </code></pre>
  
  <p>when I attempt to use line();</p>
  
  <p>My browser does support WEBGL, if I write draw() as</p>
  
  <pre><code>function draw(){
    box();
  }
  </code></pre>
  
  <p>a box does indeed get drawn. </p>
  
  <p>The only way I've currently found to draw a line is to write my own function</p>
  
  <pre><code>function drawLine(x1, y1, z1, x2,y2, z2){
    beginShape();
    vertex(x1,y1,z1);
    vertex(x2,y2,z2);  
    endShape();
  }
  </code></pre>
  
  <p>which does draw a line in 3D space, but the console generates many errors of the form</p>
  
  <blockquote>
    <p>Error: WebGL: vertexAttribPointer: -1 is not a valid <code>index</code>. This
    value probably comes from a getAttribLocation() call, where this
    return value -1 means that the passed name didn't correspond to an
    active attribute in the specified program.</p>
  </blockquote>
  
  <p>in so doing, so something must be wrong there as well.</p>