XML Feeds

.

[jitter] lua gencoord

(())_n kinomatic at gmail.com
Tue Oct 23 20:40:38 MDT 2007


Hi lua maxers,

I started doing some work with jit.gl.lua and thought I would post  
what I found out.
I noticed if I use an instance of jit.expr in lua I had to bracket  
the input and output with an instance of jit.matrix (vpoint, vgen) to  
be able to perform the matrixcalc and use the data within lua code or  
output it. Is there a simpler way to calculate matrix messages in  
jit.gl.lua? This is the only way I could get it to work so far...

(())_n

http://home.earthlink.net/~posit/lua

-- lua code

render_context = this.drawto
autogarbage = 1
autowatch = 1
gc = 1
points = 50

-- called on every gl.draw unless @automatic 0
function draw()
	makepoints()
end

-- generate points
function makepoints()
	local vpoint = jit.matrix(2, "float32", points, points)
	local vgen = jit.matrix(2, "float32", points, points)
	local vexpr = jit.new("jit.expr")
	vexpr.expr = {"norm[0]", "norm[1]"}
	vexpr.inputs = 1
	vexpr.type = "float32"
	vexpr:matrixcalc(vpoint.name, vgen.name)
	outlet(0, "jit_matrix", vgen.name)
end

-- set the dimensions of the matrix
function dim(x)
	points = x
end


More information about the jitter mailing list