thanks wes, lua is so flexible<br><br>i'm still having difficulties with the placement of <br> gl.Enable("BLEND")<br> gl.BlendFunc(1,6)<br> gl.ClearColor(0,0,0,0.5)<br>my intuition tells me it should be in the init function, but no go.
<br><br><div class="gmail_quote">On Jan 2, 2008 5:26 AM, Wesley Smith <<a href="mailto:wesley.hoke@gmail.com" target="_blank">wesley.hoke@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sorry, there was a slight typo in my script in the last post. Here's<br>a fixed version:<br><div><div></div><div><br><br>autowatch = 1<br>print("compiled")<br>render_context = this.drawto<br>
angle=0<br>mouseXY={0,0}<br>dir=1<br><br><br><br>function BuildLists()<br><br> box = gl.GenLists(2)<br> gl.NewList(box ,"COMPILE");<br> gl.Begin("QUADS")<br> gl.Vertex (-0.5
,
0.5 , 0. ) -- Top Left<br> gl.Vertex ( 0.5 , 0.5 , 0. ) -- Top Right<br> gl.Vertex ( 0.5 ,-0.5 , 0. ) -- Bottom Right<br> gl.Vertex (-0.5 ,-0.5 , 0. )
<br> gl.End();<br> gl.EndList()<br>end<br>function init()<br>--initialize the dispaly list<br> if(this.context ~= 0) then<br> BuildLists()<br> end<br>end<br><br><br>-- functions as variables!
<br>function setOnReloadOrDestChanged(func)<br> script_load = func<br></div></div> dest_changed = func<br><div><div></div><div>end<br>setOnReloadOrDestChanged(init)<br><br>--[[<br>This section is equivalent to the above
<br><br>function script_load()<br> init()<br>end<br><br>function dest_changed()<br> init()<br>end<br>--]]<br><br>function draw()<br> gl.Clear("COLOR_BUFFER_BIT" , "DEPTH_BUFFER_BIT")<br>
--gl.LoadIdentity()<br> --gl.Enable("BLEND")<br> --gl.BlendFunc(1,6)<br> --gl.ClearColor(1,1,0,1)<br> rot()<br> for i=0,1000 do<br> gl.Translate(mouseXY[1],mouseXY[2],(i/1000)-1);<br> gl.Rotate
(angle,0,0,1)<br> gl.Color(i/1000, math.random(), 1, i/1000)<br> gl.CallList(box)<br> end<br><br>end<br><br>function rot()<br> angle = angle+dir<br> if angle==15 then dir= -0.5<br> elseif angle==0 then dir=
0.5<br> end<br>end<br><br>--create the listener callback function<br>function callback(event)<br> if(event.eventname == "mouseidle") then<br> local _glXmouse = event.args[1]<br> local _glYmouse =
event.args[2]<br> --need to transform mouse ccordinates to world domain<br> --dono why, but 0.95 needed<br> mouseXY=jit.gl.screentoworld({_glXmouse,_glYmouse, 0.95})<br> end<br>end<br><br>--create a listener object
<br>listener = jit.listener(render_context, "callback")<br>_______________________________________________<br>jitter mailing list<br><a href="mailto:jitter@cycling74.com" target="_blank">jitter@cycling74.com</a>
<br><a href="http://www.cycling74.com/mailman/listinfo/jitter" target="_blank">
http://www.cycling74.com/mailman/listinfo/jitter</a><br></div></div></blockquote></div><br>