protofuse's video generator design…

Jan 22, 2012 at 3:09pm

protofuse's video generator design…

Hi mates,
hope you’re all right.

I’m currently designing my video generator.
The system will include many slots like: internal generation, external source (webcam for instance, streams), local playing (video files)

I’m talking about internal generation here.
I’ll use JS to create what I’ll call js video units

I tested these different ways and I wanted to know your feelings/opinions about that

- MGraphics inside JSUI then output a matrix to a jit.windows
- JS drawing on LCD then output a matrix to a jit.windows
- JS directly used to draw to a jit.windows

#61257
Jan 22, 2012 at 5:44pm

i do not know, because i am no jitter expert, so i would have to test your tests (!).

however, at this beginning stage i would seriously consider doing everything with jit.gl.lua instead of js (faster, more powerful), and do it heavily modularised and on the gpu (as you know of course). jit.gl.gen’s, jit.gen’s inside poly~s etc etc.

naturally i’d be very interested what you come up with. good luck.

#220826
Jan 22, 2012 at 6:02pm

never used lua
it could be a nice jump to learn it a bit

I want to start very light
even 2D
I’m loving processing since … wow first versions and I’ll translate a bunch of animations made with it into JS 2D.
This is the main reason I’ll go JS, because I need a prototype quite soon.

I need to have a video chain including many sources
I need to have “little” modules in JS (or jit.gl.lua as you suggested) I can easily integrate for a particular purpose (show), remove for another one, or eventually load/kill dynamically

this lua/GL has to be considered just after the first structure I’m currently finishing (I mean, the modular stuff is already possible here and it isn’t actually too complex (and WON’T be)

talk soon, pid

#220827
Jan 23, 2012 at 10:29pm

After some discussions with a couple of wise friends, I won’t go to JS to jit.lcd.

I’m almost convinced to use JSUI / MGraphics.
We can (quite) easily pop out a matrix from JSUI.

My only question: I don’t need the UI part of JSUI :p
I mean: I’d use MGraphics with JS (which is very interesting in my case: translating my bunch of processing patch to max), but the best way would be to “disable” the self-display of JSUI maybe to save cpu… no sure if it does make sense.

I’d be happy to have some nice advice from JCK :D

#220828
Jan 23, 2012 at 10:42pm

FWIW, don’t overlook two things:

1. There is no JSUI required for MGraphics in ordinary JS. For example:
var mymgraphics = new MGraphics(width,height);

2. The jit.mgraphics object , which can be used from Max, Java, JS, or C.

And definitely spend some time with Darwin’s great MGraphics examples for some practical MGraphics. Essentially the same logic applies.

#220829
Jan 23, 2012 at 10:45pm

(MASSIVE HUGS ; now digging & sketching ; hug to the cat too!)

#220830
Jan 23, 2012 at 11:40pm

because I want to be able to use code snippets as module instantiated easily (not necessarily dynamically at all), JS seems a nice way.

JS instantiating MGraphics stuff, then popping out matrices VS JS driving jit.mgraphics, that is the question.

Joshua, would you have some examples of those two cases?

– 1st one : JS instantiating MGraphics then pop matrix out
I tried to use the Tojitter.js from Darwin’s example inside a [js ] but without success:

var mymgraphics = new MGraphics(300,240);

mymgraphics.init();
mymgraphics.relative_coords = 0;
mymgraphics.autofill = 0;

var outmatrix = new JitterMatrix(4, "char", 256, 256);
var rotation = new Array(0.0, 0.0, 0.0);

mymgraphics.redraw();

function bang()
{
	var theImage = null;
	var width = 300;
	var height = 240;

	with (mymgraphics) {
		push_group();

		set_source_rgb(120,200,210);
		ellipse(50,50,100,100);
		fill();

		identity_matrix();
		theImage = new Image(pop_group());
		image_surface_draw(theImage);
	}

	theImage.tonamedmatrix(outmatrix.name);
	outlet(0, "jit_matrix", outmatrix.name);

	gc();
}

I surely made a mistake somewhere.

– 2nd one : JS “driving” the dedicated jit.mgraphics
… still looking for a basic example.

About CPU & efficiency, are those 2 ways equals ?

Thanks again for your precious help at this point of my research.

#220831
Sep 20, 2012 at 11:10am

hello,

had the same problem.
solved it. if you remove the line: “push_group();” , the script works.

kugelschreiber

var outmatrix = new JitterMatrix(4, “char”, 256, 256);
var rotation = new Array(0.0, 0.0, 0.0);

mymgraphics.redraw();

function bang()
{
var theImage = null;
var width = 300;
var height = 240;

with (mymgraphics) {
//push_group();

set_source_rgb(255,0,0);
ellipse(50,50,100,100);
fill();

identity_matrix();
theImage = new Image(pop_group());
image_surface_draw(theImage);
}

theImage.tonamedmatrix(outmatrix.name);
outlet(0, “jit_matrix”, outmatrix.name);

gc();
}

#220832
Oct 15, 2012 at 5:07pm

I am exploring porting processing sketches to Max as well. I am glad I saw this thread.
When I run the above example, the outmatrix name is sent out the outlet, but I do not
see the outmatrix. Am I missing something?

#220833
Oct 15, 2012 at 9:53pm

Ahhh got it now. Pretty cool!
Is there a way I can send a jitter matrix to my js mgraphics object?

Ultimately I would like to create my own video FX chain and be able
route the output of some video process to js/mgraphics.

Anthony

#220834
Oct 15, 2012 at 10:02pm

There are some nice examples in the jitter tutorial about JS (let me know if you have problems with them)

Btw, jit.gen world is also THE way to go, if you own gen of course

#220835

You must be logged in to reply to this topic.