capturing texture of jit.gl.node with jit.gl.asyncread

petcode's icon

Hello jitter fellows,

I have a problem capturing the texture of my jit.gl.node with jit.gl.asyncread.

My goal is to output a lowres version of my render context on a jit.window, and to capture a highres offscreen version of the same render context.

I am using jit.gl.node with (@adapt 0 @dim 1280 720 @name sub-node @capture 1)
Here i am able to get the highres texture.

But i am unable to get this texture with jit.gl.asyncread.
I need a matrix to save it with jit.record.

The jit.gl.asyncread reference says:
Additionally it can reference the name of a jit.gl.node sub-context.

If i send a "drawto sub-node" message to my jit.gl.asyncread i am not getting a matrix out ...

Capturing the texture to a jit.matrix is not an option for me, because of the low performance.
In my current patch, i want to get the best capture resolution, i could get.

I also tried jit.gl.syphonserver and the "Syphon Recorder" application.
But in my scenario i can not use it because i have to capture automatically very time slices.
Applescript or Automator to control "Syphon Recorder" is to slow and buggy to do this ....

I attached a patch with demonstrate the issue.

Perhaps someone can give me a hint in the right direction.

Thanks in advance,
Petcode

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

The patch:

yopla's icon

as i used it, jit.gl.asyncread use the size of a jit.window (and this window must be visible 1, contrary to syphon)
you should probably use another window for asyncread and record it

petcode's icon

thanks yopla,

but i dont want to record the texture of a window.
i want to record the texture output from jit.gl.node with the jit.gl.asyncread object.

It should be possible, the jit.gl.asyncread reference says:
Additionally it can reference the name of a jit.gl.node sub-context.

All the best,
Petcode

Andro's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here you go.

petcode's icon

Hello Andro,

Thanks for looking into it.
But I am trying to output a window in low resolution like 320 x 240.
and capture a highres content of a jit.gl.node with jit.gl.asyncread without dislaying it.
(offscreen without a window)

The question is, how we can get the content of a jit.gl.node with jit.gl.asyncread.

Perhaps its not possible.
i dont know how to get jit.gl.asyncread reference to a name of a jit.gl.node sub-context, as the reference said.

All the best,
Petcode

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

yes, unfortunately asyncread will only output at the resolution of your jit.window (or jit.pwindow).
you could try creating a new shared context at the hi-res dimensions, and using asyncread on that context:

petcode's icon

Hello Rob,

Thank you very much for your suggestion.
This will work in my case ! Hopefully this will be efficient enough on my machine ;-)

There are 2 more questions :

1)
Is there a possibility to hide the share context window ? (without movieng it offscreen )
visible 0 stops jit.gl.asyncread matrix output.

2)
What does the description in the helpfile of then jit.gl.asyncread mean ?
"Additionally it can reference the name of a jit.gl.node sub-context"
For me, it implements that i can grab a window or a jit.gl.node.

All the best,
Petcode

Rob Ramirez's icon

1 - unfortunately not, you can minimize it though

2 - that's simply the stock gl object reference info. all gl objects have that in their ref page. you can reference a sub-context but it will keep the dimensions of the main context window.

petcode's icon

Hey Rob,

Thank you very much for the expanations and the help.

Perhaps it would be a great addition to jitter,
if we could get a matrix from a texture with the efficiency of the jit.gl.asyncread.
I also tryed to build a "Syphon Recorder" app with max, but i always had to render out the texture to a window ...

The gpu > cpu jit.matrix way is definitly to slow in the age of hd video....

All the best,
Petcode