Definitely avoid using shared_context for this, you'll need it later
for the preview window:)
My new favorite way of capturing various objects to different textures
without thinking too much about the order, with automatic 1, proper
alpha channels, depth_enable, blending etc, etc, is using:
the jit.gl.sketch (tm) (best gl object ever!)
the idea is to group objects using one sketch per group and drawobject
messages. Then capture those groups to texture simply using @capture
attribute to enclosing sketch.
another tip for good capturing is to avoid using erase message to
jit.gl.render, since it can fill the background around the captured
object with it's alpha value, and it also can't fill the background
with the alpha of 0.
So, i prefer using:
the jit.gl.sketch (tm)
for clearing the context, using: glclearcolor, glcleardepth, glclear
and @automatic 0
instead of sending erase to jit.gl.render, just bang this object at
the beginning of the draw cycle.
I've attached two patches to demonstrate this. First one demonstrates
what I mentioned above, and second one has a bit more details, ideas
and bugs.
Second example also shows how one could have a better blending and
depth sorting using old gl trick of first drawing all non-transparent
objects, and then transparent ones over them. This system queries
blend_enable and color attributes and then sorts drawing order based
on that.
It also has a post-process stage that uses slabs to process two
captured groups and then display this on the third videoplane.
I know this explanation is a bit short and fuzzy, so please feel free
to ask more questions!
-nesa
multicapture-simple: