jit.window + jit.gl.sketch value scaling

    Jun 27 2010 | 7:48 pm
    I'm using Graham Wakefield's GL buffer patch to try and learn some openGL stuff in Jitter. I'm finding the scaling relationship between the pixel-position of the mouse within jit.window and the value range needed to draw into it with jit.gl.sketch confusing.
    I can't work out the relationship between these value ranges........the patch will demonstrate this; it works until the window is re-sized, after which my scaling is incorrect (understandably) but I can't work out how to fix this.
    Thanks for the help.

    • Jun 28 2010 | 8:55 pm
      I know I'm impatient :) .......but *bump*
      Does anyone know?
    • Jun 28 2010 | 9:47 pm
      i would probably just use the "screentoworld" message to gl.render:
    • Jun 28 2010 | 10:09 pm
      Ok thanks, that takes care of one issue.......now to figure out how to stop window resizing from changing the selection size relative to the size of jit.window.
      Is there an explanation anywhere in the max docs about how the GL drawing scale relates to pixels that I've overlooked? Your suggestion works, but I still don't understand what the relationship is between screen and "world" coordinates.
      Thanks for the help!
    • Jun 29 2010 | 6:37 pm
      Back again, do you know why this patch only draws the upper half of the green line?
      * warning - noob question *
      Is it because I need more than one "plane" to draw into with jit.gl.render, so that the drawing commands of the line and the selection box don't conflict?
      Cheers for the help.
    • Jun 29 2010 | 7:06 pm
      i believe the linesegment message should be like this:linesegment $1 2 -2 $1 -2 -2
      you will want to turn on blend_enable on your gl.sketch, and provide an alpha value of less than 1. for the glcolor that colorizes the glrect. this will allow you to see through the rect to the green line.