drawing lines wont show
Posted: 27 Feb 2013, 23:46
I can't get my widget to draw lines.
Very simple example:
the part with the gl.Vertex gets called and the x,y,z values are ok. But there is nothing visible on screen. What am I doing wrong?
The OpenGL coordinates and the unit positions are the same I suppose!?
Very simple example:
Code: Select all
local function TestDraw()
gl.Color({1,1,1,0})
for sniper in pairs(sniperList) do
local x, y, z = Spring.GetUnitPosition(sniper)
gl.Vertex(x,y,z+1000)
gl.Vertex(x,y,z-1000)
gl.Vertex(x,y+1000,z)
gl.Vertex(x,y-1000,z)
gl.Vertex(x+1000,y,z)
gl.Vertex(x-1000,y,z)
end
end
function widget:DrawWorldPreUnit()
gl.DepthTest(true)
gl.BeginEnd(GL.LINE, TestDraw)
end
The OpenGL coordinates and the unit positions are the same I suppose!?