Using 2D GL Objects as alpha masks over video and other layers

    Jul 06 2013 | 10:14 pm
    I've put together a simplified/clarified patch to demonstrate the problem I'm trying to solve. I have a piece that uses crossfading still images as the primary background, then 2D GL objects in the foreground that act as alpha masks over QT video. I'm still fairly new to Jitter (old to Max/MSP), and so the original version of this piece just mixed video and GL without any concept of optimizing to run on the GPU (and thus, my frame rates were terrible and the patch fell back to software GL).
    I've been in the process of rewriting everything to work via and slab objects, but have hit a block, illustrated in the example patch. I've tried playing with the blend settings of the video (Layer 1) and the 2D objects (Layer 2), but without much luck. My understanding of GL is still fairly limited, and so I'm hoping someone can help nudge me out of this rut. Many thanks!

    • Jul 07 2013 | 1:23 am
      here's one way, using the mix operator.
      capture the shapes to texture using gl.node @capture 1, and use the alpha value of the captured texture to mix the two movies.
    • Jul 07 2013 | 2:04 am
      Yes, that's exactly what I was looking for. I haven't learned about yet, and while I had played with, I wasn't sure how to use it in that context. I switched the second two inputs to around in your example, so it now shows the still images in the background, and the 2D objects revealing the qt movie underneath. Many thanks Rob!
    • Jul 07 2013 | 3:33 am
      One quick question: In my full-scale patch, I have three objects inside three copies of an abstraction. I have to connect the object through inlets on each of those abstractions where they then connect to the and objects. However, I get "attached object is not ob3d" as an error from Does this mean it is actually failing, or is it just complaining about the initial connection to the abstraction, but still gets through to the objects inside to create the sub-context? Thanks!
    • Jul 08 2013 | 4:44 pm
      the gl.node connect-to-objects outlet doesn't work through abstractions or sub-patchers.
      however you simply provide the gl objects the name of the gl.node, for patch-cordless adding to the sub-context.
      eg: ctx @name sub-ctx sub-ctx sub-ctx
    • Jul 09 2013 | 7:56 pm
      Thanks Rob! I actually figured that part out a little while after posting my question and got it all working (your earlier answer solved my problem, so thank you again!), but I figured it was still a legitimate question, i.e., doesn't the connect-to-objects outlet not working through abstractions or sub-patchers break a fundamental piece of the max model? I guess that's really a question for the Jitter dev team, but from a programming perspective, I'm interested to know if there's a reason for that seemingly inconsistent behavior re patching through.
    • Jul 23 2013 | 6:50 am
      Hi -
      I'm struggling with this issue of and sub-patcher hierarchy a bit, also..
      I've attached an example patch.
      I have a render context in the front, a node in a sub-patcher...but what I'd like to be able to do is include multiple sub-patchers onto the same node..
      I'm sure this is somewhere in the forum already, but I haven't been able to find it..
    • Jul 23 2013 | 6:58 am
      Nevermind, got it!