• Am I drawing an invisible spheres ?
    4 replies, posted
I'm trying to draw spheres, so I did the following: [CODE]if CLIENT then local positions = {} // here the table positions is filled... hook.Add("PostDrawOpaqueRenderables", "sphere_draw", function(b1, b2) print("Drawing...") for i = 1, #positions do render.DrawSphere(positions[i], 500, 1, 1, {76, 181, 108, 50}) end end) end[/CODE] The problem is that it's not working, I also get no errors and I'm sure the code is being executed because the print("Drawing...") fills my console. Can someone help me please? I think the problem might be with the HOOK I'm using, but I'm not sure which one should I use to draw it. Thanks in advance.
You gotta set the material beforehand, and use proper color structure instead of that table.
[QUOTE][/QUOTE]Ok I did the replacement, but what you mean the pharse below? [QUOTE]You gotta set the material beforehand[/QUOTE] Also it did not worked, nothing changed, although you were right it requires a Color table not a simple table, thanks for that. [editline]26th April 2014[/editline] Look, I added the Color table as you said, but it still does not work, also you said that I had to set the material, could you please explain how can I do that, none of the parameters of the render.DrawSphere function specify such thing. [CODE]if CLIENT then local positions = {} // table gets filled here... hook.Add("PostDrawOpaqueRenderables", "positions_draw", function(b1, b2) for i = 1, #positions do render.DrawSphere(positions[i], 500, 50, 50, Color(76, 181, 108, 50)) end end) end[/CODE] Come on, can someone help me please?
[lua] //Outside of the hook local arrow = Material("widgets/arrow.png", "nocull") for i = 1, #positions do render.SetMaterial( arrow ) render.DrawSphere(positions[i], 500, 1, 1, Color(76, 181, 108, 50)) end [/lua]
Thanks gonzalolog! [QUOTE=gonzalolog;44653881][lua] //Outside of the hook local arrow = Material("widgets/arrow.png", "nocull") for i = 1, #positions do render.SetMaterial( arrow ) render.DrawSphere(positions[i], 500, 1, 1, Color(76, 181, 108, 50)) end [/lua][/QUOTE]
Sorry, you need to Log In to post a reply to this thread.