Forums > Jitter

mouse 2 sketch

June 25, 2008 | 8:47 pm

Hello,

I need to give glvertex values to [jit.gl.sketch] from pwindow’s mouse message, accurately as "left-top-right-bottom" values (see jit.lcd)

My matrix is 320/240 size, but glvertex think different!

Is there a way to do that?

I had a look at screentoworld in another topic, but can’t figure out how to use it for such a goal.

thank you very much.


June 25, 2008 | 10:30 pm

i do something like this, but may not work for everyone.
when math doesn’t like you, trial and error is your friend.

– Pasted Max Patch, click to expand. –

June 26, 2008 | 6:28 am

jit.gl.render can tell you where your pixel is at:
send the mouseposition as screentoworld to the render and it gives you
OpenGL coords.

hth

/*j

– Pasted Max Patch, click to expand. –

June 26, 2008 | 7:38 am

Thank you Jasch.
Do you think you could post a patch for Max 4.6/1.6.3 ?

thank you.


June 26, 2008 | 7:54 am

here you are:

#P toggle 212 50 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 212 70 69 196617 idlemouse $1;
#P newex 212 30 60 196617 loadmess 1;
#P user jit.pwindow 211 89 322 242 0 1 1 0 1 0;
#X name WORLD;
#P newex 212 493 22 196617 b 1;
#P newex 212 520 104 196617 pack position 0. 0. 0.;
#P newex 212 465 51 196617 zl slice 2;
#P newex 212 553 375 196617 jit.gl.gridshape WORLD @scale 0.1 0.1 0.1
@lighting_enable 1 @color 1. 0.5 0. 1.;
#P newex 212 337 112 196617 route mouse mouseidle;
#P newex 212 439 102 196617 route screentoworld;
#P message 212 362 105 196617 screentoworld $1 $2;
#P toggle 10 30 15 0;
#P newex 10 406 212 196617 jit.gl.render WORLD @erase_color 0. 0. 0. 1.;
#P newex 10 77 58 196617 t b b erase;
#P newex 10 52 57 196617 qmetro 20;
#P connect 9 0 7 0;
#P connect 8 0 10 0;
#P connect 8 0 9 1;
#P connect 13 0 11 0;
#P connect 14 0 13 0;
#P connect 12 0 14 0;
#P connect 2 1 5 0;
#P connect 1 0 2 0;
#P connect 1 2 2 0;
#P connect 4 0 2 0;
#P connect 0 0 1 0;
#P connect 3 0 0 0;
#P connect 11 1 6 0;
#P connect 6 0 4 0;
#P connect 6 1 4 0;
#P connect 10 0 9 0;
#P connect 5 0 8 0;
#P window clipboard copycount 15;


Viewing 5 posts - 1 through 5 (of 5 total)