feature request


    Aug 23 2007 | 12:59 am
    can jit.gl.graph get @matrixoutput 1 capability, please? many thanks.
    j

    • Aug 23 2007 | 1:44 am
      On Aug 22, 2007, at 5:59 PM, joshua goldberg wrote:
      > can jit.gl.graph get @matrixoutput 1 capability, please? many thanks.
      In the absence of such a utility, this sort of thing really isn't
      tough to build. Just use the incoming matrix value as the Y axis for
      top row of vertices with either a zero Y value (unipolar display) or
      a negative Y value (bipolar display) for the bottom row of vertices,
      and render with the quad_grid primitive.
      Here's another JS based patch which does it more explicitly with a
      sine wave that you might find useful. JS necessary below patcher
      file. Have fun.
      -Joshua
      // js_jittersinesplit-example.pat:
      // js_jittersinesplit.js:
      var autowatch = 1;
      var cy = new Array();
      var vbrgb = [1.,0.5,0.];
      var vfrgb = [0.,0.,1.];
      var vslices = 200;
      var vscale = 0.2;
      var voffset = 0.;
      var vphase = 0.;
      var vfrequency = 10;
      newcurve();
      function bang()
      {
      draw();
      }
      function newcurve()
      {
      var i;
      var iscale = 2*Math.PI*vfrequency/(vslices-1);
      var p = vphase*2*Math.PI;
      with (Math) {
      for (i=0;i cy[i] = sin(i*iscale+p);
      }
      }
      }
      function draw()
      {
      var i;
      var iscale = 2/(vslices-1);
      outlet(0,"reset");
      outlet(0,"glcolor",vbrgb);
      outlet(0,"glbegin","tri_strip");
      for (i=0;i outlet(0,"glvertex",i*iscale-1,1,0);
      outlet(0,"glvertex",i*iscale-1,cy[i]*vscale+voffset,0);
      }
      outlet(0,"glend");
      outlet(0,"glcolor",vfrgb);
      outlet(0,"glbegin","tri_strip");
      for (i=0;i outlet(0,"glvertex",i*iscale-1,cy[i]*vscale+voffset,0);
      outlet(0,"glvertex",i*iscale-1,-1,0);
      }
      outlet(0,"glend");
      }
      function slices(v)
      {
      vslices = Math.max(v,1);
      newcurve();
      draw();
      }
      function phase(v)
      {
      vphase = v;
      newcurve();
      draw();
      }
      function frequency(v)
      {
      vfrequency = v;
      newcurve();
      draw();
      }
      function brgb(r,g,b)
      {
      vbrgb[0] = r;
      vbrgb[1] = g;
      vbrgb[2] = b;
      draw();
      }
      function frgb(r,g,b)
      {
      vfrgb[0] = r;
      vfrgb[1] = g;
      vfrgb[2] = b;
      draw();
      }
      function scale(v)
      {
      vscale = v;
      draw();
      }
      function offset(v)
      {
      voffset = v;
      draw();
      }