bang out from ob3d

maxmspjit's icon

hi all, I'm having a bit of trouble wrapping my head around
communication between the max wrapper and a jitter object. I would
like to output a bang when the jitter object state meets certain
criteria. this is complicated by the fact that I'm trying to do this
in gl, as it seems the usual trick is to supply a manual mproc
function and do some setup / postflight there.

my best guess so far is that I have to do something with
jit_object_method and _jit_sym_getoutput, but I'm not entirely clear
what incantation is necessary to pull this all together. do I need to
pass a pointer to the max object to the jitter object?

I found some code jeremy wrote that looks like this:

void *mop = jit_class_adornment_get(_myobject_class, _jit_sym_jit_mop);
void *o = jit_object_method(mop, _jit_sym_getoutput, 1);

but I don't believe I have a mop as it is a gl object. is there
something similar I can use?

r.

Joshua Kit Clayton's icon

On Jan 11, 2007, at 3:07 PM, ritchie argue wrote:

> but I don't believe I have a mop as it is a gl object. is there
> something similar I can use?

If you really want to, you can pass in your max object wrapper to
your inner jitter class however you see fit, though it is not
recommended so that your class is useful from within JS, Java, and
any future language bindings. Typically we recommend this sort of
communication via jit_object_notify. This can notify the client max
wrapper object (or JitterListener in JS/Java), to do something like
send data out an outlet mid-process. In the SDK this is discussed a
bit in the context of a MOP:

As for getting access to the outlet pointers, you can cache the
results of outlet_new in your max wrapper object struct for things
like the following.

max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
max_jit_ob3d_attach(x, jit_ob, outlet_new(x, "jit_matrix"));

// could be:

x->dumpout = outlet_new(x,NULL);
max_jit_obex_dumpout_set(x, x->dumpout);

x->matrixout = outlet_new(x, "jit_matrix");
max_jit_ob3d_attach(x, jit_ob, x->matrixout);

Or you could create additional outlets if you prefer.

-Joshua