hi, all (err... wesly)<br>i have been doing some lua coding on an xp machine.<br><br>i have a few questions,<br>1. something strange about the screentoworld routine, when z is set to 0. or 1. i get unusable results. when at 
0.95 its almost there, why?<br>2. i use display lists, is that good? were do i plug the gl states in that situation. i want blend effects. i commented the lines i think i need.<br>3. when i enter fullscreen i lose the drawing.
<br><br>thanks , it&#39;s fun coding in lua. and i feel can tackle some of nehe&#39;s opengl tutorial with it.<br>posting on the list so i hope it will not break in the forum.<br><br><br><br>autowatch = 1<br>print(&quot;compiled&quot;)
<br>render_context = this.drawto<br>angle=0<br>mouseXY={0,0}<br>dir=1<br>&nbsp; <br>function BuildLists()<br><br>&nbsp;&nbsp;&nbsp; box = gl.GenLists(2)&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; gl.NewList(box&nbsp;&nbsp;&nbsp; ,&quot;COMPILE&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gl.Begin(&quot;QUADS&quot;)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gl.Vertex (-0.5 , 0.5 , 0. )&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- Top Left<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gl.Vertex ( 0.5 , 0.5 , 0. )&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- Top Right<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gl.Vertex ( 0.5 ,-0.5 , 0. )&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- Bottom Right<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
gl.Vertex (-0.5 ,-0.5 , 0. )&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gl.End();<br>&nbsp;&nbsp;&nbsp; gl.EndList()<br>end<br>function init()<br>--initialize the dispaly list<br>&nbsp;&nbsp;&nbsp; BuildLists()<br>end<br>init()<br><br>function draw() <br>&nbsp;&nbsp;&nbsp; gl.Clear(&quot;COLOR_BUFFER_BIT&quot; , &quot;DEPTH_BUFFER_BIT&quot;)&nbsp;&nbsp;&nbsp; 
<br>&nbsp;&nbsp;&nbsp; --gl.LoadIdentity()&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; --gl.Enable(&quot;BLEND&quot;)<br>&nbsp;&nbsp;&nbsp; --gl.BlendFunc(1,6)<br>&nbsp;&nbsp;&nbsp; --gl.ClearColor(1,1,0,1)<br>&nbsp;&nbsp;&nbsp; rot()<br>&nbsp;&nbsp;&nbsp; for i=0,1000 do<br>&nbsp;&nbsp;&nbsp; gl.Translate(mouseXY[1],mouseXY[2],(i/1000)-1);<br>
&nbsp;&nbsp;&nbsp; gl.Rotate(angle,0,0,1)<br>&nbsp;&nbsp;&nbsp; gl.Color(i/1000, math.random(), 1, i/1000)<br>&nbsp;&nbsp;&nbsp; gl.CallList(box)<br>&nbsp;&nbsp;&nbsp; end<br><br>end<br><br>function rot()<br>&nbsp;&nbsp;&nbsp; angle = angle+dir<br>&nbsp;&nbsp;&nbsp; if angle==15 then dir= -0.5<br>&nbsp;&nbsp;&nbsp; elseif angle==0 then dir=
0.5<br>&nbsp;&nbsp;&nbsp; end<br>end&nbsp; <br>&nbsp; <br>--create the listener callback function<br>function callback(event)<br>&nbsp;&nbsp;&nbsp; if(event.eventname == &quot;mouseidle&quot;) then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; local _glXmouse = event.args[1]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; local _glYmouse = 
event.args[2]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --need to transform mouse ccordinates to world domain<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --dono why, but 0.95 needed<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mouseXY=jit.gl.screentoworld({_glXmouse,_glYmouse, 0.95})<br>&nbsp;&nbsp;&nbsp; end<br>end<br><br>--create a listener object
<br>listener = jit.listener(render_context, &quot;callback&quot;)<br><br>++++++++++++++++++<br>patch<br>++++++++++++++++<br>#P window setfont &quot;Sans Serif&quot; 9.;<br>#P window linecount 1;<br>#P newex 22 154 311 9109513 
jit.gl.lua nehe @file nehe1_displaylist.lua @autogarbage 1 @autowatch 1;<br>#P toggle 123 71 15 0;<br>#P message 123 91 68 9109513 fullscreen \$1;<br>#N vpatcher 30 89 166 253;<br>#P window setfont &quot;Sans Serif&quot; 9.;
<br>#P newex 50 71 35 9109513 sel 27;<br>#P newex 50 50 40 9109513 key;<br>#P outlet 50 93 15 0;<br>#P connect 1 0 2 0;<br>#P connect 2 0 0 0;<br>#P pop;<br>#P newobj 123 51 33 9109513 p Esc;<br>#P newex 123 109 70 9109513 
jit.window nehe;<br>#P toggle 21 45 15 0;<br>#P newex 21 64 57 9109513 qmetro 30;<br>#P newex 21 85 50 9109513 t b erase;<br>#P newex 21 111 77 9109513 jit.gl.render nehe;<br>#P connect 6 0 4 0;<br>#P connect 7 0 6 0;<br>
#P connect 5 0 7 0;<br>#P fasten 1 0 0 0 26 106 26 106;<br>#P fasten 1 1 0 0 66 106 26 106;<br>#P connect 2 0 1 0;<br>#P connect 3 0 2 0;<br>#P window clipboard copycount 9;<br><br><br>