exact positioning of elements in gl.sketch


    Dec 15 2008 | 11:04 am
    Hi all,
    I was wondering how I can position a couple of videoplanes on a pixel-
    accurate position within an opengl environment.
    Here's the thing : I have a background image (on a videoplane filling
    the screen), with 2 holes cut out, using alphachannels. I know where
    and how big these holes are in pixels, but how do I translate this to
    opengl so I can position 2 other videoplanes on the exact location?
    Trial and error gives me the right spot, but there's got to be someway
    to do this without guessing, right?
    regards,
    Brecht.

    • Dec 15 2008 | 11:30 am
      GL will normalize
      coordinates across [-1, 1] x [-1, 1]
      HTH
    • Dec 15 2008 | 11:41 am
      so divide 1 by the input
      0.0 0.0 will be the middle
      Anybody tell me how many decimal points GL will use for positioning?
      If I divide 1 by four then everything is easy as you get 0.25
      BUT if I have 1 by 14 then I get 7.142857142857e-02
      So for accurate positioning how many places do I use say for a position message?
    • Dec 15 2008 | 12:50 pm
      Ok. That was simple... so basically it could be done like this :
      trigger display to get resolution, input pixels, output gl coords.
      On 15 Dec 2008, at 12:30, Carl Rohumaa wrote:
      >
      > GL will normalize
      > coordinates across [-1, 1] x [-1, 1]
      >
      > HTH
    • Dec 15 2008 | 12:54 pm
      Well, sort of works for me, there's some bugs in there :) Too quick
      with it.
      On 15 Dec 2008, at 13:50, Brecht Debackere wrote:
      > Ok. That was simple... so basically it could be done like this :
      > trigger display to get resolution, input pixels, output gl coords.
      >
      >
      >
      >
      >
      > On 15 Dec 2008, at 12:30, Carl Rohumaa wrote:
      >
      >>
      >> GL will normalize
      >> coordinates across [-1, 1] x [-1, 1]
      >>
      >> HTH
      >
    • Dec 15 2008 | 1:09 pm
      Can't open your patch as I am only on Max4.6
      You will need to get the scale right on the videoplane and then send messages like @position 0.5 -0.5 to get stuff in the right place.
      I am using @texture_reset 2 message in the videoplane in my context
    • Dec 15 2008 | 1:15 pm
      I have started drawing this stuff on paper so I can visualize what I am doing before I start inputting numbers. BTW the coordinates will be from the middle of your object so you might have to take this into account.
      So anybody tell me how many decimal places to use? So for example if my calculations give me 0.3141592653589793 etc
    • Dec 15 2008 | 1:45 pm
      you could of course send jit.gl.render the 'screentoworld x y z'
      message and get the gl coords out of its dumpout
      On 15 Dec 2008, at 14:15, Carl Rohumaa wrote:
      >
      > I have started drawing this stuff on paper so I can visualize what I
      > am doing before I start inputting numbers. BTW the coordinates will
      > be from the middle of your object so you might have to take this
      > into account.
      >
      > So anybody tell me how many decimal places to use? So for example if
      > my calculations give me 0.3141592653589793 etc