XML Feeds

.

[javascript-dev] creating jit.matrix in javascript...

Anthony Palomba apalomba at austin.rr.com
Wed Jan 16 16:12:14 MST 2008


I am trying to create a jit.matrix in javascript and 
then connect it to a jit.gl.render. It looks like I 
am creating everything but my matrix does not show up 
in my jit.window. I think the problem is that I am not 
connecting my matrix to my jit.gl.render. How exactly 
do I do this from javascript?


my javascript, plasma.js...

// create our window
var window = new JitterObject("jit.window","testwindow");
window.depthbuffer = 1;
window.idlemouse = 1;

// create our render object for our window
var render = new JitterObject("jit.gl.render","testwindow");
//render.ortho = 2; //2d mode

// create our matrix
var draw_matrix = new JitterObject("jit.matrix", 4, "float32", 256, 256); 
draw_matrix.exprfill("hypot(norm[0]-0.5\,norm[1]-0.5)");


var mousedown = 0;

// create our listener object for our window
var mylistener = new JitterListener("testwindow",callbackfun);

function callbackfun(event)
{	
	var x,y,button;

	if (event.eventname=="mouse") 
	{
		// arguments are (x,y,button,cmd,shift,capslock,option,ctrl)
		x = event.args[0];
		y = event.args[1];
		button = event.args[2];
		mousedown = button;
	} 
	else if (event.eventname=="mouseidle") 
	{
		x = event.args[0];
		y = event.args[1];
	} 
	//post("callback: " + event.subjectname + " sent "+ event.eventname + " with (" + event.args + ")
");
}
callbackfun.local = 1;

function bang()
{
	if (mousedown)
		render.depth_clear();  // note that 
	else 
		render.erase();
	
	draw_matrix.bang;
	render.drawclients();	
	render.swap();
}




my patch...

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 102 133 40 9109513 compile;
#P number 87 82 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 42 81 15 0;
#P newex 42 106 55 9109513 qmetro 20;
#P newex 42 161 58 9109513 js plasma.js;
#P comment 156 166 234 9109513 example of listening to a window for window events;
#P connect 4 0 2 1;
#P connect 2 0 1 0;
#P connect 5 0 1 0;
#P connect 3 0 2 0;
#P window clipboard copycount 6;






More information about the javascript-dev mailing list