jit.qt.movie –> videoplane –> window in JS problems

Mar 5, 2013 at 2:57am

jit.qt.movie –> videoplane –> window in JS problems

Greetings, hive mind,

I’m attempting to write a moviebank type thing in js, based on the moviebank example, with two main differences:

1. the movies all play simultaneously (not the biggest deal, I think)
2. each movie has its own videoplane, and those are offset relative to each other in a window

I’m not getting the planes to show up, although as far as I can tell, movies are successfully loading into the jit.qt.movie objects, and nothing seems out of order with instantiating my videoplanes. I suspect I’m doing something wrong in the bang() function, but my researches so far have yet to provide me with an answer. I’d appreciate it if someone could have a look for me…

Thanks!

JS: (moviebank.js)

//moviebank.js

autowatch = 1;

outlets = 3;

var window = new JitterObject(“jit.window”,”window”);
window.size = [1280, 320];

var render = new JitterObject(“jit.gl.render”,”window”);

var vdim = [320,240];
var vindex = 0;
var vcount = 0;
var movArray = new Array(); //jit.qt.movie objects
var outMatrix = new Array(); // intermediate matrices — I don’t even know if I need these…
var planeArray = new Array(); //videoplanes
var dummymatrix = new JitterMatrix(4,”char”,vdim[0],vdim[1]);
var filenames = new Array();

// I think my error is in here — in theory, I’m passing the movies to the matrices, and then using the matrix name to assign it to the videoplane

function bang() {

render.erase();
for(var i = 0; i
movArray[i].matrixcalc(outMatrix[i]/*null*/,outMatrix[i]);
planeArray[i].jit_matrix(outMatrix[i].name);
planeArray[i].draw();
}
render.drawswap();
}

/*
function index(i)
{
if (i>=vcount)
i = vcount-1;
if (i<0)
i = 0;

movArray[vindex].stop();
vindex = i;
movArray[vindex].start();
}
*/

function readfolder(foldername)
{
var fold;
var i,rv;

fold = new Folder(foldername);
fold.typelist = ["MooV","PICT","MPEG","GIFf","JPEG","PNG","TIFF","SWFL","8BPS","BMP","VfW"]
if (fold.count) {
// reset old movies
for (i=0;i
movArray[i].dispose();
movArray[i].matrixcalc(dummymatrix/*null*/,dummymatrix);
}
// build filename array
vcount = 0;
fold.reset();
filenames = new Array();
outlet(1,”clear”); //clears menu, which we probably don’t need
// load new movies
for (i=0;i
fold.next();
filenames[vcount] = fold.pathname + “/” + fold.filename;
movArray[vcount] = new JitterObject(“jit.qt.movie”);
// add movie attributes here
movArray[vcount].vol = 0;
movArray[vcount].colormode = “uyvy”;
movArray[vcount].unique = 1;

rv = movArray[vcount].read(filenames[vcount]);
if (rv[1]==1) { // success, read returns an array [filename,success]

// create intermediate matrices and videoplanes

outMatrix[vcount] = new JitterMatrix(4,”char”,vdim[0],vdim[1]);
planeArray[vcount] = new JitterObject(“jit.gl.videoplane”, “render”);
// add plane attributes here
planeArray[vcount].transform_reset = 2;
planeArray[vcount].colormode = “uyvy”;
planeArray[vcount].automatic = 0;
planeArray[vcount].rotatexyz[0,0,90];
planeArray[vcount].scale[0.2,0.2,1];
planeArray[vcount].color[1,1,1,1];

//position planes here — this is sloppy, but not the problem…

var max = -6;
var offset = .4;
var pos = (max+ (vcount * offset));
planeArray[vcount].postion = [pos, 0., 0.];
post(“nposition ” , pos, “vcount ” , vcount);

outlet(1,”append”,fold.filename);
movArray[vcount].loadram;
movArray[vcount].matrixcalc(outMatrix[vcount]/*null*/,outMatrix[vcount]);
vcount++;
}
}
if (vindex>=vcount)
vindex = 0;
// movArray[vindex].matrixcalc(outMatrix[vindex]/*null*/,outMatrix[vindex]);
outlet(2,vcount);
}
}

function dim(width,height)
{
vdim[0] = width;
vdim[1] = height;
for (i=0;i
outMatrix[i].dim = vdim;
}
dummymatrix.dim = vdim;
}

/*
function anything()
{
//pass off all other messages to the movie object
var a = arrayfromargs(arguments);
if (Function.prototype.isPrototypeOf(movArray[vindex][messagename])) {
movArray[vindex][messagename](a);
} else {
movArray[vindex][messagename] = a;
}
}

*/

Patcher:


----------begin_max5_patcher----------
991.3oc0XssjZiCD8Y3qvKOy5XYysYea+.xWPpTTx1M1Brk7JICSHU92WcwF
PCCFCgYJxK3RG0Rp6S2p6V7ygCFEydEDi79Guu4MXvOGNXfARCLnY7fQk3WS
JvBiXiRXkk.UNZrcNI7pzfWvvodBVI3UBoDr2JBWH+qVwpvxjbBMaIGRj1iK
L5E+fwdn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S5g1D9o
oMQ8TatmrN1Lz3pps.WzrkFEQU1ZMiqGNarYHgZGZ1Q0iP1RZkewP8t8qg+O
FKVY0B
-----------end_max5_patcher-----------
#66860
Mar 5, 2013 at 11:37am

Hi Matthew,

Your render and window are named “window” (I would choose a different name to avoid potential collisions, but that’s just me), but your videoplanes are named “render”. I haven”t tested your JS with that fix, but it seems like the most likely culprit on a quick scan.

Jeremy

#240665
Mar 5, 2013 at 1:40pm

Jeremy!

I’m too stupid to live, obviously. This is why I never get called back for those jobs at Google. I had the same problem in high-school math — I understood the logic, but let the details slip through….

Thanks, Jeremy.

M

#240666

You must be logged in to reply to this topic.