Preview window in OpenGL

laserpilot's icon

So I'm trying to add a preview window to my massive video performance patch as per the instructions in Recipe 39 but I seem to be missing something, or maybe the recipe has a little more than what I need?

My chain goes video-> slab chain -> 4 bpatchers for corner-pinning that terminate in jit.gl.mesh's (each bpatcher goes to a seperate layer)

I don't have any gl.videoplanes in use like the recipe demonstrates, except for the one that I'm trying to use to send to a jit.pwindow..everything is coming from my gl.mesh's

I guess I'm asking where I need to capture the texture from..do i need to add @capture sc_tex to my gl.mesh's and leave a [jit.gl.texture @name sc_tex] in my master renderer, or would it be better to somehow capture the texture at the end of the slab chain and not worry about..I've tried a couple combinations with no success yet..

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

instead of explaining, i've created a patch that might be easier to understand than the recipe.
let me know if anything is still not clear:

laserpilot's icon

Thanks, that got me a lot closer than I was getting last night. I'm now getting something in both windows. I ended up putting a videoplane at the end of my slab chain and before it gets split out into my 4 individual cornerpin meshes.

I tried adding @capture finalcap to the meshes (theyre the same patch repeated with '#1' arguments to determine their layers) but only the top layer was represented in both windows. If i just stop it with a videoplane, my fullscreen window can still see the quad-warped meshes, but my preview just sees the fullframe video that comes at the end of the slabchain. Is there something else I could be doing, or would it just be easier to leave my preview window simple without capturing 4 seperate textures from the meshes?

One more question, what would be the best way to save FPS and turn the preview window off when I need to..where should I put my gates? I'm thinking before the gl.render preview and the gl.videoplane at the end of the slabchain. I just want to avoid unnecessary operations.

Thanks again

Rob Ramirez's icon

a gl.texture can only capture a single opengl object.
this is why in the jitter recipe, the capturing is done from a jit.gl.sketch.
you must name all your gl objects, and tell you sketch to draw them with the "drawobject" message, and set the @capture on your sketch.

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

you can toggle the preview context simply by putting a gate on your drawbang and erase messages to the preview jit.gl.render.

laserpilot's icon

Amazing..I can feel my gl powers growing! haha...I got it to work after messing with the drawobject gl.sketch order and double checking my blending modes and such. This is going to help a lot when I try to make that scenewarp patch into a slab chain effect...thanks for what you do for everyone here rob!