How to get matrixoutput from jit.gl.gridshape

Dec 30, 2007 at 6:14am

How to get matrixoutput from jit.gl.gridshape

Hi list,

I’m currently trying to get the hang of javascript with jitter, but
I’ve hit a bit of a snag. I’m trying to recreate Andrew’s Jitter
Recipe 12: Texture Distortion in js. I need to be able to grab the
output matrix of a jit.gl.gridshape object in matrixoutput mode. 1)
How do I do this? and 2) Is it necessary to declare a render
destination if the gridshape is only used in matrixoutput mode?

Here’s the relevant code:

var myShape = new JitterObject(“jit.gl.gridshape”); //Render
destination necessary?
myShape.shape = “plane”;
myShape.dim = [2, 2];
myShape.matrixoutput = 1;
var shapeMatrix = new JitterMatrix(3, “float32″, 2, 2);

function bang() {
myShape.matrixcalc(shapeMatrix, shapeMatrix) //What’s the right
method call?
outlet(0, “jit_matrix”, shapeMatrix.name);
}

Thanks for any insights.

#35153
Dec 30, 2007 at 6:21am

I don’t think you can grab the matrixoutput in JS since that is part
of the maxwrapper which JS has no access to. JS Jitter objects simply
reference the bare Jitter object (this will make more sense if you
have ever done any Jitter C dev or have read related docs. It might
even be mentioned in the JSJitter docs). Anyway, there have been
threads on this topic before and I believe the conclusion was it’s
simply not possible due to the lack of outlet knowledge in JS.

As an alternative, gridshapes can be easily built with jit.expr
expressions. In fact the name jit.gl.gridshape comes from the mapping
of the vertex data to a grid aka a matrix and the simple expressions
used to generate the corresponding geometry.

best,
wes

On Dec 30, 2007 12:14 AM, Jack Phillips wrote:
> Hi list,
>
> I’m currently trying to get the hang of javascript with jitter, but
> I’ve hit a bit of a snag. I’m trying to recreate Andrew’s Jitter
> Recipe 12: Texture Distortion in js. I need to be able to grab the
> output matrix of a jit.gl.gridshape object in matrixoutput mode. 1)
> How do I do this? and 2) Is it necessary to declare a render
> destination if the gridshape is only used in matrixoutput mode?
>
> Here’s the relevant code:
>
> var myShape = new JitterObject(“jit.gl.gridshape”); //Render
> destination necessary?
> myShape.shape = “plane”;
> myShape.dim = [2, 2];
> myShape.matrixoutput = 1;
> var shapeMatrix = new JitterMatrix(3, “float32″, 2, 2);
>
> function bang() {
> myShape.matrixcalc(shapeMatrix, shapeMatrix) //What’s the right
> method call?
> outlet(0, “jit_matrix”, shapeMatrix.name);
> }
>
> Thanks for any insights.
>
>

#119433
Dec 30, 2007 at 8:10am

I think if you use JitterListener with a jit.gl object with
@matrixoutput 1 you can get access to the matrix output in javascript.
Should work but long time since I tested this.

Let us know if it doesn’t work.

-Joshua

On Dec 29, 2007, at 10:21 PM, “Wesley Smith”
wrote:

> I don’t think you can grab the matrixoutput in JS since that is part
> of the maxwrapper which JS has no access to. JS Jitter objects simply
> reference the bare Jitter object (this will make more sense if you
> have ever done any Jitter C dev or have read related docs. It might
> even be mentioned in the JSJitter docs). Anyway, there have been
> threads on this topic before and I believe the conclusion was it’s
> simply not possible due to the lack of outlet knowledge in JS.
>
> As an alternative, gridshapes can be easily built with jit.expr
> expressions. In fact the name jit.gl.gridshape comes from the mapping
> of the vertex data to a grid aka a matrix and the simple expressions
> used to generate the corresponding geometry.
>
> best,
> wes
>
> On Dec 30, 2007 12:14 AM, Jack Phillips
> wrote:
>> Hi list,
>>
>> I’m currently trying to get the hang of javascript with jitter, but
>> I’ve hit a bit of a snag. I’m trying to recreate Andrew’s Jitter
>> Recipe 12: Texture Distortion in js. I need to be able to grab the
>> output matrix of a jit.gl.gridshape object in matrixoutput mode. 1)
>> How do I do this? and 2) Is it necessary to declare a render
>> destination if the gridshape is only used in matrixoutput mode?
>>
>> Here’s the relevant code:
>>
>> var myShape = new JitterObject(“jit.gl.gridshape”); //Render
>> destination necessary?
>> myShape.shape = “plane”;
>> myShape.dim = [2, 2];
>> myShape.matrixoutput = 1;
>> var shapeMatrix = new JitterMatrix(3, “float32″, 2, 2);
>>
>> function bang() {
>> myShape.matrixcalc(shapeMatrix, shapeMatrix) //What’s the
>> right
>> method call?
>> outlet(0, “jit_matrix”, shapeMatrix.name);
>> }
>>
>> Thanks for any insights.
>>
>>

#119434

You must be logged in to reply to this topic.