Forums > Jitter

How to …

November 13, 2008 | 9:43 pm

Hello,

I’d like to put down (draw with mouse…) an indeterminate numbers of points in a scene first, then, move these points on xyz.

I don’t want to draw the points or shapes as if I would draw only ONE gridshape and would not clear the render, for example,
but real elmts, all contro-able on xyz (with jit.expr later).

- The first solution I see is "reset, point xyz" to sketch
but if I want to draw 400 autonomous points, I need 400 messages box or 400 messages in the same box or anything equivalent :(
..and I don’t know how many points I’ll draw :((

- The second solution is [jit.iter] to "position", like in many examples, but I think I would not have a good control on the flow …

- A third one could be to use a float32 matrix with dims 20 20 for example, but how to progressively iterate it?
If I bang it, 400 elmts go out!

- I didn’t really already took my head on particles system in jitter (vishnu etc.).
But is it possible to birth particules on demand?

Could someone point me the way.

thanks.


November 14, 2008 | 11:15 pm

anyone nyone one n .. .


November 15, 2008 | 12:06 am

On Thu, Nov 13, 2008 at 11:43 PM, Derrick Giscloux
wrote:

>
> Hello,
>
>
> I’d like to put down (draw with mouse…) an indeterminate numbers of
> points in a scene first, then, move these points on xyz.

>
> – A third one could be to use a float32 matrix with dims 20 20 for
> example, but how to progressively iterate it?
> If I bang it, 400 elmts go out!

that’s the best option, its will take some time to warp your head around it
but matix are the native format for mass manipulation of "lists" in jitter.
400 elements are nothing.

>
> – I didn’t really already took my head on particles system in jitter
> (vishnu etc.).
> But is it possible to birth particules on demand?

im still not sure what your after, better explain better, better better is
to post a patch

see this hack i did on the shatter recipe by Andrew, deconstructing that
recipe- for me- was key for matrix+opengl understanding

http://www.cycling74.com/forums/index.php?t=msg&goto=116508#msg_num_11


November 15, 2008 | 12:38 am

Yes! thanks Yair!
I worked on this, since now

But what about iterate a matrix?

I can send all the cell to mesh, and make quads but it is one stack of cells.

How to have cell appear after cell … ?


November 15, 2008 | 1:01 am

On Sat, Nov 15, 2008 at 2:38 AM, Derrick Giscloux
wrote:

>
> Yes! thanks Yair!
> I worked on this, since now
>
> But what about iterate a matrix?
>
its hard to understand your goal, cant help further
im on max 4.6 btw

>
> I can send all the cell to mesh, and make quads but it is one stack of
> cells.
>
> How to have cell appear after cell … ?
>


November 15, 2008 | 9:41 am

I’m on 4.6 too.

I want to some drawing in jitter, via [jit.window]->[route mouse].

But rather than (for example) don’t clear the render and keep trails of an object, I want the mouse to put points (ex: w/mesh).

Further I’d like to apply forces to these points.

Is there a way to do that (put individual points) ?


November 15, 2008 | 10:30 pm

First of all, I think you’re correct in your assumption that handling
all the data *outside the matrix* would be difficult. 400 elements
processed iteratively can be difficult.

Do as much as possible inside a matrix, and only "spill" it if need be.

So, for instance (and this is just one way of doing things – probably
not the optimal one!):

Mouse input -> setcell in jit.matrix, where x/y/z and other parameters
get stored, four params per cell.
Then you can choose to either apply jit.op or similar to the *entire*
matrix, or apply a gradient to that processing, giving you a gradual
implementation of the operation.
Another way would indeed be to iterate through it, each new step with a
new degree of processing – the heavy part, computationally, would be
extracting this data and then reintroducing them to a new matrix (or the
same, in a feedback loop).

Much better to stay in the matrix. And yes, 20×20 cells is NOTHING. :)

Hope this rant helps, at least a little?

Andreas.


November 15, 2008 | 11:31 pm

Yes, thank you Andreas, it is fine.


December 13, 2008 | 12:29 pm

I)

Thanks again. see patch below.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 31 71 27 196617 t b l;
#P newex 112 191 46 196617 s mouse;
#B color 5;
#P message 272 511 105 196617 screentoworld $1 $2;
#P newex 272 490 65 196617 route mouse;
#P newex 91 137 38 196617 s bang;
#B color 5;
#P message 63 222 161 196617 name 400isnothing , size 320 240;
#P user jit.pwindow 59 241 322 242 0 1 0 0 1 0;
#X name 400isnothing;
#P newex 67 164 126 196617 jit.gl.render 400isnothing;
#P newex 67 102 58 196617 t b b erase;
#P number 797 132 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 789 73 57 196617 • reset all;
#P button 773 72 15 0;
#P message 548 426 94 196617 setall 0 -0.8 , bang;
#P newex 737 151 64 196617 speedlim 50;
#P newex 545 248 27 196617 t l b;
#P message 797 227 44 196617 setall 0;
#N counter 0 1 400;
#X flags 0 0;
#P newobj 737 173 83 196617 counter 0 1 400;
#P newex 737 204 32 196617 sel 0;
#P newex 759 226 27 196617 – 1;
#P newex 759 248 31 196617 / 20;
#P newex 715 324 30 196617 pack;
#P newex 715 282 34 196617 % 20;
#P toggle 545 163 15 0;
#P newex 545 183 29 196617 gate;
#P newex 545 276 64 196617 unpack 0. 0.;
#P newex 545 226 51 196617 zl slice 2;
#P newex 545 203 102 196617 route screentoworld;
#P newex 564 162 46 196617 r mouse;
#B color 5;
#P toggle 475 133 24 0;
#P newex 475 97 60 196617 loadmess 1;
#P newex 494 243 38 196617 r bang;
#B color 5;
#P toggle 475 244 15 0;
#P newex 475 264 29 196617 gate;
#P user jit.pwindow 484 486 82 62 0 1 0 0 1 0;
#P newex 545 352 265 196617 pack 0. 0. 0 0;
#P message 545 376 144 196617 setcell $3 $4 val $1 $2 , bang;
#P window linecount 2;
#P newex 475 557 230 196617 jit.gl.mesh 400isnothing @texture tex1 @draw_mode points @point_size 7 @automatic 0;
#P window linecount 1;
#P newex 486 454 130 196617 jit.matrix 3 float32 20 20;
#P connect 26 0 25 0;
#P connect 26 0 21 2;
#P connect 21 0 20 0;
#P connect 13 0 3 0;
#P connect 13 1 3 1;
#P connect 16 0 17 0;
#P connect 18 0 17 1;
#P fasten 0 0 1 0 491 483 480 483;
#P fasten 0 0 4 0 491 483 490 483;
#P connect 5 0 1 0;
#P fasten 30 1 36 0 188 186 117 186;
#P connect 29 0 30 0;
#P connect 29 2 30 0;
#P fasten 37 1 30 0 53 154 72 154;
#P fasten 19 0 16 0 764 245 720 245;
#P connect 19 0 18 0;
#P connect 28 0 24 1;
#P fasten 23 1 24 0 567 270 671 270 671 139 742 139;
#P connect 24 0 21 0;
#P fasten 2 0 0 0 550 396 491 396;
#P fasten 25 0 0 0 553 447 491 447;
#P fasten 35 0 37 0 277 547 26 547 26 63 36 63;
#P connect 32 0 31 0;
#P fasten 37 0 29 0 36 95 72 95;
#P connect 29 1 33 0;
#P fasten 31 1 34 0 375 486 277 486;
#P connect 34 0 35 0;
#P connect 8 0 9 0;
#P connect 9 0 6 0;
#P connect 6 0 5 0;
#P connect 7 0 5 1;
#P fasten 9 0 15 0 480 160 550 160;
#P connect 15 0 14 0;
#P connect 14 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 23 0;
#P connect 23 0 13 0;
#P connect 3 0 2 0;
#P connect 10 0 14 1;
#P connect 17 0 3 2;
#P connect 20 1 19 0;
#P fasten 20 0 22 0 742 224 802 224;
#P window clipboard copycount 38;


December 13, 2008 | 12:36 pm


December 13, 2008 | 5:08 pm

–>
I don’t want to draw the points or shapes as if I would draw only ONE gridshape and would not clear the render, for example,
but real elmts, all contro-able on xyz (with jit.expr later).
–>

As far as the "clear" goes, you can also use the "clear" command to jit.gl.render, but use an erase_color with a very low alpha (like erase_color 0. 0. 0. 0.001). This will take a long time to clear out what’s there, so you’ll get long trails of your points etc. Using a low alpha for your points will also allow lots more drawing before you get a screen full of opaque points.

20X20 is definitely a small matrix :) but don’t be afraid of using something like [uzi] either, to draw your points, if it works better. However, all the jit.ops available will probably work best for you.

Whatever you draw into a jit.gl.sketch can then be stretched, rotated, etc. as a group.


December 13, 2008 | 5:28 pm

> Whatever you draw into a jit.gl.sketch can then be stretched, rotated, etc. as a group

Could you provide a little example?


December 13, 2008 | 10:52 pm

Just use a [scale float float float] to the jit.gl.sketch, as you can with most GL objects. Also there’s position, rotatexyz, etc. Until you "reset" the jit.gl.sketch, it’ll remember everything on there and you can transform it however you want (at least that’s my understanding).

Try out this example patch, hopefully is self-explanatory. Simple, yet still fun to mess with :)

Sorry only Max 5, screenshot attached to see what’s going on if you’re on 4.

– Pasted Max Patch, click to expand. –

December 13, 2008 | 10:56 pm

–>
As far as the "clear" goes, you can also use the "clear" command to jit.gl.render
–>

My mistake, I meant "erase", using the different alpha values for erase_color.


December 14, 2008 | 8:32 pm

Thanks for the screenshot seejayjames.
So it just works like any other gl’

—————-

I wonder why there is nothing about "beginstroke" in jitter Object Reference.

Some on the sketch commands would be hidden? or I have to read the Open GL books?

This object seems huge.
Where to start for specifics?

Thank you.


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