Matrix comparison to jit.gl.pix

your dad's icon

Hello,

I'm new to gl.pix and run into this simple issue:

I'd like to convert this:

jit.op @op < @val 0.5

to a jit.gl.pix

How can I use a float param in this case?

Thanks, zb

OCH's icon

Here is the answer to your question:

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


Now the problem, that I am also trying to figure out myself, is how to avoid the smoothness of the pixels that come from a matrix into the texture world. I've had some success using jit.gl.texture, but then I've found that later on it will cause some other problems, as I've reported on that other thread.

Good luck with your patch!

mattyo's icon

To avoid the smoothing, run the texture through [jit.gl.texture @filter none]. Have a look at the patch.

\M

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

OCH's icon

Dear Mattyo,

Thank you so much for chiming in.

Unfortunately, as soon as you pass the output of jit.gl.texture to a jit.gl.pix the smoothing comes back again. Do you have any thoughts about this? (jit.gl.pix doesn't seem to have a @filter attribute either)

O

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

Rob Ramirez's icon

sendoutput filter none

mattyo's icon

Hi Omar,
You just have to put the jit.gl.texture at the very end of your processing chain before you send it out to your videoplane or whatever. I'm no gen guru, but I'm pretty sure there isn't a way to achieve this inside jit.gl.pix. However, it doesn't really cost you anything to stick that jit.gl.texture on at the end...

\M

mattyo's icon

As usual, it looks like Rob has the answer!

OCH's icon

Sorry I am bit lost here: where do I type "sendoutput filter none"?

mattyo's icon

Send it as a message to the jit.gl.pix:

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

OCH's icon

oooo, very sleek. I understand now that jit.gl.pix is, in effect, like a jit.gl.texture as input, jit.gl.texture as output, and some other (gen) things in the middle. But you can still change some properties in those hidden jit.gl.texture "inlets and outlets" by sending them a direct message. Crazy!
Thanks.

mattyo's icon

No problem, but ultimately Rob gets the credit!

\M

tommyecho's icon

Hi everyone! I'm confused by the original solution that Och posted. The jit.gl.pix produces a red square, whereas the jit.op produces a white square. Why is there this different behavior? I'm working on replacing all the matrix objects with jit.gl.pix or jit.gl.slab, and I'm stumped trying to replace a jit.op !- @val 255 with a jit.gl.pix object. Any help would be greatly appreciate!