jit.gl.render: Control 3D obj WITHIN the patch window+ ALSO in floating window?

azahn123's icon

I am trying to create a VJ type setup with a jit.gl.render 3D object::: Being able to grab and move around the 3D object on the screen IN THE PATCHER window,, and have that motion / rotation SHOW in REAL TIME in the floating window... This way you could have a full screen external window (Being projected) AND be able to control the 3D object IN the PATCHER window (This way not showing the mouse while the 3D object is being controlled).
The help file for jit.gl.render ... It shows how to toggle between views BUT NOT in REAL TIME. So I am lost...
Thanks in advance !

Rob Ramirez's icon

there's a few ways to achieve this, but easiest is probably setting @shared 1 on you preview window and main window, creating a gl.node bound to your preview context, adding all drawing objects to that gl.node, capturing the gl.node to a texture (@capture 1), and displaying that texture on videoplanes in your two drawing contexts.

any animation objects attached to your objects bound to the gl.node which is drawing to the preview context, will receive mouse messages from the preview context.

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

patch below should get you started. let me know if you have any further questions:

vade's icon

You can send jit.gl.handle messages to more than one object at a time.

A good solution in Max 6 would be to parent your whole world under a jit.gl.node. Make a second context that renders to a preview window, which has something like a torus, or basic GL object rendering at a lower FPS in there. Hook up a jit.gl.handle to the torus, but *also* send the messages to the main jit.gl.node on your output. You can then manipulate the jit.gl.handle on the torus in your preview and have it translate, rotate, scale your scene in the VJ output.

I was going to make a demo patch, but Max 6 crashed, and I wrote a bug report instead.

vade's icon

Rob, that patch does not work for me under Max 6.0.3, (the scene renders but the handle/jit.anim does not rotate anything in the preview window, or the main window)

Rob Ramirez's icon

ahh yes. my apologies, that bug has been fixed for the next release.

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

here's a version that uses gl.handle instead of anim.drive that should work in 6.0.3:

azahn123's icon

Thanks so so much ! This is EXACTLY what I wanted ! I really appreciate the help !

azahn123's icon

Actually I have another stupid question... It seems that the size of the window in the patcher determines the size / resolution of the floating window's content (ie The window in the patcher has to be at least as big as the floating window for the resolution to hold up)...
What I really wanted was a small preview window in the patcher that I could grab the 3d objects with to manipulate ... But have a HUGE floating window with high quality visual output... This way I could control multiple small windows within the patcher before "mixing" them to the large floating window...

azahn123's icon

Here is what I am working with ,,,

azahn123's icon

Here is the file ... I am super new using gl with max .. Wanted to create a control window for this...

3219.17.TwineBallsnow3controlScreen.maxpat
Max Patch
Rob Ramirez's icon

on your jit.gl.node set @adapt 0 and @dim to the dimensions of your large window.

azahn123's icon

Ok got it ! Thanks Robert ! ... PS can you show me how to connect my above attached patch in order to integrate this method into a patch... Thanks ! Like I said, I am pretty ok using msp ... but not jitter .. I am a total novice.