Switching between patches

triscuit's icon

I need to be able to switch between jitter patches. I'm pretty sure I can use poly to achieve this. The only problem is that poly is very complicated.

Can anyone show me an example?

I just hope I can switch 3d patches without leaving full screen.
Do I just need to name my windows the same thing?

dan's icon

poly~ is for managing multiple instances of the *same* patch. For
switching between different patches, look at the drawto message to
jit.gl.render, the thispatcher object, and Andrew's Recipe 24:
GLFeedBack:

best,
dan

Andrew Benson's icon

Most likely the best solution would be to set @automatic 0 on all of
your gl.objects, and explicitly bang each object. Then, you simply gate
off the objects that you don't want to see for any given scene. Another
solution would be to use the enable attribute to turn on and off your
gl.objects.

Cheers,
Andrew B.

Jean-Francois Charles's icon
triscuit's icon

Thanks for the responses guys.

Do any of these solutions save on CPU cycles? This is why I thought of poly~ because it actually turns things off instead of things just looking like they are off.

The problem I am having is that poly~ doesn't seem to turn off normal messages. It turns off signals fine, but normal messages that come out seem to keep flowing even when a mute is received at thispoly~.

Any help would be great. I'm not quite sure how to use thispatcher but that seems like it might work too. Scripts maybe?

triscuit's icon

I'm working on trying to get automatic 0 to work. Again, I'm dumb and can't get it to work right. Do I need to place it on every gl object or just the ones running to the main screen?

Router would just be a tool to organize it all, right?

I can't find out how to use the enable command to clear everything.
Using automatic 0 things still seem to get stuck in the screen. I looked at the GL feedback and that didn't seem to help me even though it seemed to do what I wanted. It really didn't seem to run right. I think it might be a Mac only patch.

To summarize my gl objects are getting stuck in the window and won't transition to a new gl object. Any help on how to clear them would be great.

Brecht's icon

You don't need to use automatic 0 for the jit.gl.render object.
The fact that things stay on your screen probably has to do with
the erase_color of the jit.gl.render object. The message should be :
erase_color 0. 0. 0. 1. (with the first 3 zero's for r, g, b, the
fourth nr. is the one which cause the screen not to clear entirely
when it is set below 1., depending on how low it is, 0 being the
lowest, things will stay on screen longer or 'fade away' slowly.
Furthermore, make sure you use the 'deph_enable' 0 or 1 depending on
what you want to accomplish

when using the automatic 0 argument, you need to individually bang
every GL object in which you use it. Say you draw a primitive using
jit.gl.gridshape and a text using jit.gl.2dtext, both with automatic
0 enabled, you will see the following :
when banging the gridshape first, the shape will be drawn on screen,
then you bang the gl.text, which will be rendered on top of your shape.
If you send them a bang in the other order, you'll render the text
first, and then the shape on top of it, blocking out the text.
The best way to do this is to send the bangs of the qmetro to a
trigger object. Where you use the amount of bangs needed according to
the amount of jit.gl.something objects you use.
In the above example that would be : t b b b erase The most right
outlet of the object is connected to the jit.gl.render, clearing the
scene, then the following two bangs to the gridshape and text object,
depending which one you render first, you connect the third outlet to
the first one you want to render on screen, and the seconde outlet to
the one you wish to bang next.
Finally, the first bang goes into jit.gl.render again which puts the
resulting image in your window.

Hope this clears things up a bit...

Brecht's icon

and/or like this :

Max Patch
Copy patch and select New From Clipboard in Max.

triscuit's icon

Thanks for all the help guys. I'm just trying to chug along with my limited knowledge.

Brecht I couldn't get the example patch to open.

Is it missing header information something like:

Max Patch
Copy patch and select New From Clipboard in Max.

Brecht's icon

select it, copy, in max select file > new from clipboard

triscuit's icon

Thanks a lot guys, I really appreciate it. I’m finally getting somewhere.

The only problem is that on full screen the object duplicates and starts flashing. Otherwise it works fine in a normal window. If all else fails I will just make the window really big.