Forums > Javascript

Array of jit.gl.videoplane holding PNGs is very CPU intensive

February 20, 2013 | 2:20 pm

I’m working on project that will string together on-the-fly user-drawn transparent PNGs in a turning spiral. There’ll be lots of drawings (like 100 or more) at any given time, ie 100 videoplanes. Even a very small number of videoplanes max’s out the Max thread making Max sluggish.

I’m only banging the movies once to load them into the videoplane. The images are small, < =2K, 600x100. Even if i don't load the images and just put up the empty videoplanes it slays the processor. (late-2011 Macbook Pro and 12-core XEON Mac Pro).

Based on the ability to place 150+ videoplanes showing my webcam (jit.gl.grab) in another patcher (can’t find the post, now, but it is a ‘time machine’ of randomly placed videoplanes) I thought this would work no problem, but I’m really struggling.

I tried Slabs outside of javascript with just 4 videoplanes and it didn’t make an appreciable difference. Since I’m not play a movie, I’m not sure it would anyway.

Here’s the javascript I’m using to load the array. Is there anything I can do to make this perform better?

function initSpiral() {
	for (i=0; i(png_file.length-1)) { j=0; }

		pngqt.matrixcalc(png_matrix[i],png_matrix[i]);
		vplane[i].jit_matrix(png_matrix[i].name);
	}
}

I’ll also attach the patcher, javascript and PNGs to see it in context. It’s stripped down – it doesn’t have the drawing part, rather this one just loads 7 drawings over and over to fill the array for now.

The number of drawings to use is set in the javascript. I lowered it to 10 for the moment, but it needs to be at more like 100+

DRAWING_COUNT=10;

I had tried texturing jit.gl.gridshapes a while back, but was having trouble with the transparency I think. It seemed like videoplanes were the way to go, but maybe not?

Thanks for any help!
Andrew


February 20, 2013 | 4:41 pm

hi andrew.
your slowdowns are all the result of setting the dim attribute of your jit.gl.videoplane, both in the javascript, and the big videoplane in your main patcher.
the dim attribute for gl objects is not related to the resolution of the matrix or texture input, but instead refers to the geometry.

simply leave the dim attributes on the gl.videoplanes to their default values, and your patch performs fine over here.


February 20, 2013 | 9:16 pm

Wow! Thanks so much. I never bothered looking at the dim attribute because it’s the one thing I thought I DID understand.

Thanks again!


Viewing 3 posts - 1 through 3 (of 3 total)