mop+ob3d: conflicting outlets?

Oct 24, 2007 at 3:05pm

mop+ob3d: conflicting outlets?

Dear list,

I am working on an external that uses both mop and ob3d. I managed to output
a video matrix, but the dump outlet doesn’t seem to be working. At first I
thought I was doing something stupid, but I really can’t figure out how to
send anything out of it. I had a similar problem when I was trying to output
a jit.gl formatted matrix using t_jit_glchunk, instead of a regular matrix
like I’m doing at the moment. That might not be related, I don’t know.
I guess since both mop and ob3d externals use a matrix and dump outlet,
there could be a conflict. The code for the wrapper’s constructor is below.
Am I missing something?

Cheers,
Thijs

void *max_m8_vshape_new(t_symbol *s, long argc, t_atom *argv)
{
t_max_m8_vshape *x;
void *jit_ob, *m;
long attrstart;
t_symbol *dest_name_sym = _jit_sym_nothing;
t_jit_matrix_info info;
void *dumpout;

if (x = (t_max_m8_vshape
*)max_jit_obex_new(max_m8_vshape_class,gensym(“m8_vshape”))) {
//get normal args
attrstart = max_jit_attr_args_offset(argc,argv);
if (attrstart&&argv)
{
jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
}

if (jit_ob=jit_object_new(gensym(“m8_vshape”), dest_name_sym)) {

max_jit_obex_jitob_set(x, jit_ob);

dumpout = outlet_new(x,NULL);
max_jit_obex_dumpout_set(x, dumpout);
max_jit_mop_setup(x);
max_jit_mop_inputs(x);
max_jit_mop_outputs(x);
max_jit_mop_matrix_args(x,argc,argv);

m = max_jit_mop_getoutput(x,1);
jit_object_method(m,_jit_sym_getinfo,&info);
info.type = _jit_sym_float32;
info.planecount = 3;
info.dimcount = 2;
jit_object_method(m,_jit_sym_setinfo,&info);

max_jit_attr_args(x,argc,argv);

// attach the jit object’s ob3d to a new outlet for matrixmode
//max_jit_ob3d_attach(x, jit_ob, outlet_new(x, “jit_matrix”));

} else {
error(“m8.vshape: could not allocate object”);
freeobject((t_object *)x);
x = NULL;
}
}
return (x);
}

#34304
Dec 18, 2007 at 12:03am

Today I worked on the code again since a while so I gave it another try,
without luck. I can’t figure it out and its driving me nuts. Tried
everything I can think of about 3 times now. Calling object_obex_dumpout()
from my jitter class never outputs anything as long as I keep the MOP and
OB3D things in there together. Any clues?

How can I avoid conflicts of dumpout and matrix out when using these two
APIs together? Is there a way to query the obex dumpout pointer from the
jitter class maybe?

The only solution I can think of now is sending my messages to a named
receive in the patcher… Not exactly what I was hoping for.

Any help is greatly appreciated.

Thijs

On Oct 24, 2007 3:05 PM, Thijs Koerselman

wrote:

> Dear list,
>
> I am working on an external that uses both mop and ob3d. I managed to
> output a video matrix, but the dump outlet doesn’t seem to be working. At
> first I thought I was doing something stupid, but I really can’t figure out
> how to send anything out of it. I had a similar problem when I was trying to
> output a jit.gl formatted matrix using t_jit_glchunk, instead of a regular
> matrix like I’m doing at the moment. That might not be related, I don’t
> know.
> I guess since both mop and ob3d externals use a matrix and dump outlet,
> there could be a conflict. The code for the wrapper’s constructor is below.
> Am I missing something?
>
> Cheers,
> Thijs
>
> void *max_m8_vshape_new(t_symbol *s, long argc, t_atom *argv)
> {
> t_max_m8_vshape *x;
> void *jit_ob, *m;
> long attrstart;
> t_symbol *dest_name_sym = _jit_sym_nothing;
> t_jit_matrix_info info;
> void *dumpout;
>
> if (x = (t_max_m8_vshape
> *)max_jit_obex_new(max_m8_vshape_class,gensym(“m8_vshape”))) {
> //get normal args
> attrstart = max_jit_attr_args_offset(argc,argv);
> if (attrstart&&argv)
> {
> jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
> }
>
> if (jit_ob=jit_object_new(gensym(“m8_vshape”), dest_name_sym)) {
>
> max_jit_obex_jitob_set(x, jit_ob);
>
> dumpout = outlet_new(x,NULL);
> max_jit_obex_dumpout_set(x, dumpout);
> max_jit_mop_setup(x);
> max_jit_mop_inputs(x);
> max_jit_mop_outputs(x);
> max_jit_mop_matrix_args(x,argc,argv);
>
> m = max_jit_mop_getoutput(x,1);
> jit_object_method(m,_jit_sym_getinfo,&info);
> info.type = _jit_sym_float32;
> info.planecount = 3;
> info.dimcount = 2;
> jit_object_method(m,_jit_sym_setinfo,&info);
>
> max_jit_attr_args(x,argc,argv);
>
> // attach the jit object’s ob3d to a new outlet for matrixmode
> //max_jit_ob3d_attach(x, jit_ob, outlet_new(x, “jit_matrix”));
>
> } else {
> error(” m8.vshape: could not allocate object”);
> freeobject((t_object *)x);
> x = NULL;
> }
> }
> return (x);
> }
>
>

#115484
Dec 18, 2007 at 12:39am

On Dec 17, 2007, at 4:03 PM, Thijs Koerselman wrote:

> Today I worked on the code again since a while so I gave it another
> try, without luck. I can’t figure it out and its driving me nuts.
> Tried everything I can think of about 3 times now. Calling
> object_obex_dumpout() from my jitter class never outputs anything
> as long as I keep the MOP and OB3D things in there together. Any
> clues?

You’ll need to better explain what you’re trying to accomplish and
why. Typically for our own objects we don’t use MOP with OB3D, we
just define an incoming jit_matrix method. (see jit.gl.videoplane
sample code in SDK).

> How can I avoid conflicts of dumpout and matrix out when using
> these two APIs together? Is there a way to query the obex dumpout
> pointer from the jitter class maybe?

Typically we use the object_notify mechanism to the max wrapper class
which can then output any data necessary. See the jit.notify example
source + SDK discussion about this for more info. An internal Jitter
class is better off not knowing about inlets/outlets/patcherland.
Then it’s useful in JS/Lua/Java/C.

-Joshua

#115485
Dec 18, 2007 at 5:30pm

Hi Joshua,

Sorry I wasn’t clear, but that’s probably because I still wasn’t clear on
where I was going myself. I was mixing up MOP and OB3D unnecessarily. Your
reply was the little push I needed. Thanks for pointing out the relevant
examples.

I’m extracting shapes and silhouettes from an incoming video matrix. I then
draw or output them as a gl formatted matrix. Looking at the videogrid
example, I think I can take out all the current MOP stuff in my externals
and just access the incoming matrix via the jit_matrix method.

I was always using object_obex_dumpout in the past, the notify approach
works without troubles.

Cheers,
Thijs

btw: the jitter sdk docs/ api is offline. I send an email to support
yesterday, but its still not working.

On Dec 18, 2007 12:39 AM, Joshua Kit Clayton < jkc@musork.com> wrote:

>
> You’ll need to better explain what you’re trying to accomplish and
> why. Typically for our own objects we don’t use MOP with OB3D, we
> just define an incoming jit_matrix method. (see jit.gl.videoplane
> sample code in SDK).
>
>
> > How can I avoid conflicts of dumpout and matrix out when using
> > these two APIs together? Is there a way to query the obex dumpout
> > pointer from the jitter class maybe?
>
> Typically we use the object_notify mechanism to the max wrapper class
> which can then output any data necessary. See the jit.notify example
> source + SDK discussion about this for more info. An internal Jitter
> class is better off not knowing about inlets/outlets/patcherland.
> Then it’s useful in JS/Lua/Java/C.
>
> -Joshua
>
>
>

#115486

You must be logged in to reply to this topic.