I am trying to use surface.DrawPoly() for the first time and it doesnt seem to draw anything.
[CODE]surface.SetDrawColor(0, 255, 0, 255)
surface.DrawPoly({ {100, 100}, {200, 100}, {200, 200}, {100, 200} })
[/CODE]
damn Preview Post button removing the [LUA] tags everytime :c fix it robotboy D:
[url]http://wiki.garrysmod.com/page/surface/DrawPoly[/url]
[url]http://wiki.garrysmod.com/page/Structures/PolygonVertex[/url]
surface.DrawPoly doesn't take a table of coordinates. It takes a table of specific structures called PolygonVertex. They still need to ordered like you did in your script.
Could you give me a working example?
[QUOTE=Benjiko99;43105831]Could you give me a working example?[/QUOTE]
Second post.
[QUOTE=Robotboy655;43105852]Second post.[/QUOTE]
it doesnt work, do i like need to have no material set or stuff like that?
Obviously. You can use [URL="http://wiki.garrysmod.com/page/draw/NoTexture"]draw.NoTexture()[/URL]
great, i still cant get it to work
Did you adjust the Coordinates?
I got it! @johnnyaka your example didnt work because the table needs to start from index 1 not 0.
And i think this is a much better way of writing the tables:
[CODE]local poly1 = { {x=100, y=100}, {x=200, y=100}, {x=200, y=200}, {x=100, y=200} } // outside of drawing hook
surface.DrawPoly(poly1)
[/CODE]
[QUOTE=Benjiko99;43112184]I got it! @johnnyaka your example didnt work because the table needs to start from index 1 not 0.
And i think this is a much better way of writing the tables:
[CODE]local poly1 = { {x=100, y=100}, {x=200, y=100}, {x=200, y=200}, {x=100, y=200} } // outside of drawing hook
surface.DrawPoly(poly1)
[/CODE][/QUOTE]
I hate Lua...it's not like every other language is starting with 0
Well, I think that's a matter of opinion :wink:
Sorry, you need to Log In to post a reply to this thread.