picture show questions

zipb's icon

Hi everybody!

I just bought Jitter the other day, so my questions will probably be really stupid. Sorry!

I have a folder full (42) of small JPEG's that I want to show in a 7*6 grid. I've been experimenting with JS and jit.matrix.
I can't get my head around displaying them without stretching on the proper x,y coordinates.
I guess I should use dstdimstart & dstdimend, but I don't understand how to set these variables in JS, e.g something like mymatrix.dstdimstart = [0,0];

Help would be much appreciated.

Best,

Zip

Gregory Taylor's icon

While javascript is all well and good, the humble jit.gl.videoplane
object might serve you well here by means of common messages.
As always, those tutorial things will be of some use.

Jeremy's icon

I actually think that Zip is on the right track for what he wants to do.
I'm not sure how using jit.gl.videoplane would be in any way better,
faster or easier to use for this particular task.

If you want to use JS, I believe that the syntax you've specified is
correct. Don't forget to set mymatrix.usedstdim = 1; before writing into it.

jb

Jeremy's icon

Like so:

var outmatrix = new JitterMatrix(4,"char",320,240);

function bang()
{
    outlet(0,"jit_matrix",outmatrix.name);
}

function jit_matrix(matrixname)
{
    outmatrix.usedstdim = 1;
    outmatrix.dstdimstart = [100, 100];
    outmatrix.dstdimend = [200, 200];
    outmatrix.frommatrix(matrixname);
    bang();
}

zipb's icon

Thanks, guys!

I was experimenting with JS for easy nested loops. All my ideas so far were rip-o-matics from the examples/tutorials...

I will have a look at jit.gl.videoplane

Jitter is deep, I'm afraid I'm doing stuff more convoluted than necessary.
Being new to JS doesn't help either.

Best,

Zip

zipb's icon

This what I have now in a JS object:

// inlets and outlets
inlets = 1;
outlets = 1;

var mymatrix = new JitterMatrix(4, "char", 7*65, 6*43);
var qtmatrix = new JitterMatrix(4, "char", 7*65, 6*43);
var f;

function loadbang()
{

    mymatrix.usedstdim = 1;

    f = new Folder("G5:/Users/zipboterbloem/Documents/Gemeentemuseum/Simpele Versie/fotootjes");
    for (var j=0; j < 6; j++) {
        for (var i=0; i < 7; i++) {
            qtmatrix.importmovie(f.filename);
            mymatrix.dstdimstart = [i*65, j*43];
            mymatrix.dstdimend = [i*65 + 65, j*43+43];
            mymatrix.frommatrix(qtmatrix);
            f.next();
        }
    }

    f.close();

    outlet(0, "jit_matrix", mymatrix.name);
}

What it is supposed to do:
On startup, load 42 small pix in a matrix, and show it to the unsuspecting public.
What it does: nothing on load, just the black. jit.pwindow

I have 2 questions:
1. the loadbang() is supposed to trigger on patcher load. I don't see any pix though, I just get a file slector(?). Even when I select one of my pix, nothing happens.
2. When I send the message loadbang by hand, I get a file selector. Why?
There's a complete path to the folder with pix I'm trying to read. After I select a picture file, there's a pause of a few seconds, and then my pix are shown like they should.
What am I doing wrong?
TIA for any insights...

Best,
Zip