[bug] jit.gl.text2d


    Jan 29 2006 | 1:42 am
    hi,
    After days of trying different methods, I have to conclude that there is a bug with jit.gl.text2d because it really shouldn't be so difficult to do what I'm trying to do. I want to put multiple lables of 2d text on top of the gl sketch in different positions - something that is very simple in JSUI. In my opinion Jit.text.2d should allways render on top of the sketch when screenmode = 1. Currently when automatic = 0 (neccessary for multiple labels) the text will render behind the sketch. What would be ideal would be an integration of jit.gl.text2d and jit.gl.sketch so that labelling was as easy as it is with JSUI.
    OSX 10.3.9 ibook g4 1.2ghz 768mb ram Max 4.56/jitter 1.52
    oli larkin
    // jit.gl.text2d test
    autowatch = 0;
    // Jitter Stuff ---------------------------- //------------------------------------------- var mywindow = new JitterObject("jit.window","space"); mywindow.depthbuffer = 0; mywindow.fsmenubar = 0;
    var myrender = new JitterObject("jit.gl.render","space"); myrender.ortho = 2; myrender.erase_color = [1,1,1,1];
    var mysketch = new JitterObject("jit.gl.sketch","space"); mysketch.lighting_enable = 0; mysketch.smooth_shading = 0; mysketch.cull_face = 1; mysketch.blend_enable = 1; mysketch.antialias = 1;
    var testtext = new JitterObject("jit.gl.text2d","space"); testtext.automatic = 0; testtext.color = [0.,0.,0.,1.];
    function bang() { myrender.erase();
    mysketch.reset(); mysketch.moveto([0.,0.,-1.]); mysketch.color = [1.,0.,0.,1.]; mysketch.circle(0.3);
    // how can i get this text to render on top of the ball? testtext.text("red ball"); testtext.position = [0.,0.]; testtext.draw();
    testtext.text("hello"); testtext.position = [0.5,0.5]; testtext.draw();
    myrender.drawswap(); }
    ------------------------------------------------------------ ------------

    • Jan 29 2006 | 2:04 am
      Hi Oliver,
      Here's a fix to your js script that does what you want. It's not a bug with text2d that's your problem, but a simple misunderstanding of the jitter jit.gl.render object and how it draws things. If you're going to use @automatic 0, I would reccommend using this setting for all of your gl objects. This way, you're guaranteed to have the draw order you desire. This is demonstrated in the fixed script.
      // jit.gl.text2d test
      autowatch = 1;
      // Jitter Stuff ---------------------------- //------------------------------------------- var mywindow = new JitterObject("jit.window","space"); mywindow.depthbuffer = 0; mywindow.fsmenubar = 0;
      var myrender = new JitterObject("jit.gl.render","space"); myrender.ortho = 2; myrender.erase_color = [1,1,1,1];
      var mysketch = new JitterObject("jit.gl.sketch","space"); mysketch.lighting_enable = 0; mysketch.smooth_shading = 0; mysketch.cull_face = 1; mysketch.blend_enable = 1; mysketch.antialias = 1; mysketch.automatic = 0;
      var testtext = new JitterObject("jit.gl.text2d","space"); testtext.automatic = 0; testtext.color = [0.,0.,0.,1.];
      function bang() { myrender.erase();
      mysketch.reset(); mysketch.moveto([0.,0.,-1.]); mysketch.color = [1.,0.,0.,1.]; mysketch.circle(0.3); mysketch.draw();
      // how can i get this text to render on top of the red ball? testtext.text("red ball"); testtext.position = [0.,0.]; testtext.draw();
      testtext.text("hello"); testtext.position = [0.5,0.5]; testtext.draw();
      myrender.drawswap(); }
    • Jan 29 2006 | 2:58 am
      thanks wesley! apologies to C74 for calling bug, however i still have some strange behaviour. The example above is ok but in my proper js file (with much more going on) the text doesn't draw on first load. Only when i go into the js file (autowatch on) and save the file again (perhaps adding a space or comment) does the text appear. I assume that the jit.gl.text2d is not being initialised properly. has anyone else experienced such a problem?
      oli
      my plugins - www.oli.adbe.org