Issue with jit.gl.imageunit and a texture using JS


    Feb 25 2007 | 4:42 am
    Hello List,
    Using Javascript I am trying to have an jit.gl.imageunit process a jit.gl.texture with, e.g., 'bloom'-effect, but it does not seems to work, resulting in an empty window. There seems to be something wrong with the connection between the texture and the imageunit, because the imageunit itself can easily generate the 'sunbeams' as can be seen in the example.
    I assume(d) imageunits and slabs work the same concerning how textures go in and out, or am I wrong? When I let a jit.gl.slab do the work in the same setting, it's all working properly. Since I'd like to use some imageunits-effects, I would really want to know which ingredient I am missing here.
    First I tried it in Lua, but JS is giving me the same result.
    Some advice would be really great.
    Best, Erik
    Running the latest version of Jitter on a Mac Book Pro (10.4.8)
    The script has an imageunit and a slab, the slab is disabled just as the imageunit's 'sunbeams'.
    the js:
    // save as: imageunit_js.js autowatch = 1;
    jtex = new JitterObject("jit.gl.texture","imageunit_js"); jtex.file = "colorbars.pict";
    jwobbly = new JitterObject("jit.gl.imageunit","imageunit_js");
    // enable one of those fx //jwobbly.fx = "sunbeams" // this one works fine, since it doesnt need a texture jwobbly.fx = "bloom" // this one needs a texture and does not work
    // disable the imageunit above and enable the slab here // jwobbly = new JitterObject("jit.gl.slab","imageunit_js"); // jwobbly.file = "td.wobble.jxs"
    jwobbly.texture = jtex.name; jwobbly.verbose = 1;
    jvplane = new JitterObject("jit.gl.videoplane","imageunit_js"); jvplane.automatic = 0; jvplane.transform_reset = 2; jvplane.texture = jwobbly.out_name; //show the output of wobbly
    function draw(){ jwobbly.draw(); jvplane.draw(); //post("drawn") }
    the patch:

    • Feb 25 2007 | 4:57 am
      Hi Erik, I agree that what you did should work. However, there seems to be a disconnect between the jit.gl.imageunit @texture attribute and internal operations. You can instead use the jit.gl.imageunit jit_gl_texture method and things work just fine. The same will be true in Lua since this has something to do with jit.gl.imageunit and not JS or Lua per se. Here's a modified script that does this:
      wes
      editfontsize = 13 // save as: imageunit_js.js autowatch = 1;
      jtex = new JitterObject("jit.gl.texture","imageunit_js"); jtex.file = "colorbars.pict";
      jwobbly = new JitterObject("jit.gl.imageunit","imageunit_js"); // // enable one of those fx //jwobbly.fx = "sunbeams" // this one works fine, since it doesnt need a texture jwobbly.fx = "bloom" // this one needs a texture and does not work
      // disable the imageunit above and enable the slab here // jwobbly = new JitterObject("jit.gl.slab","imageunit_js"); // jwobbly.file = "td.wobble.jxs"
      //jwobbly.texture = jtex.name; jwobbly.jit_gl_texture(jtex.name); jwobbly.verbose = 1;
      jvplane = new JitterObject("jit.gl.videoplane","imageunit_js"); jvplane.automatic = 0; jvplane.transform_reset = 2; jvplane.texture = jwobbly.out_name; //show the output of wobbly
      function draw() { jwobbly.draw(); jvplane.draw(); //post("drawn") }
    • Feb 25 2007 | 5:24 pm
      Thank you, Wesley! That looks like a very obvious solution.. which I just couldnt see at 5 a.m.. I and might need to take a closer look at some fundamentals here.
      Many thanks! Erik