![]() |
|
drawPoly - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Starfall (https://teamscm.co.uk/forum-7.html) +--- Thread: drawPoly (/thread-871.html) |
drawPoly - Destiny's Player - 16-04-2015 Good morning. I've been trying to find information on this for a pretty long time (A few hours... Yeah, not as long as it could be, but still). So, here's a question. How on earth do you use drawPoly? I know that you need to use render.createPoly({render.Vertex(x,y,u,v)...}), but... I can't understand what do the u and v parameters mean. And also, if they aren't important for basic use, then I can't get the poly to show up non-black, or even at all. Here's the code I'm trying to get to work.
RE: drawPoly - LocInt - 16-04-2015 Are you sure the vertices are in the right order? Go round the shape clockwise starting at the top left. Person's example: Code: {
render.vertex( 124, 9 ),
render.vertex( 154, 9 ),
render.vertex( 142, 21 ),
render.vertex( 112, 21 )
}RE: drawPoly - Destiny's Player - 17-04-2015 Yep, I'm sure that it's from top-left to middle-left, as it's a hexagon. LATER: Heh. Found out why on earth it doesn't work. You have to start not at the top, but at the bottom.
And from what I can tell, you have to go counter-clockwise, not clockwise.
RE: drawPoly - Person8880 - 17-04-2015 The shape you've given is going clockwise, not counter-clockwise. It is definitely clockwise that is the requirement. RE: drawPoly - Destiny's Player - 17-04-2015
Yep, looking at it, it's definately clockwise. But still, it's interesting that it requires starting from bottom-right, and when I try top-left it doesn't work... RE: drawPoly - Person8880 - 17-04-2015 The following code:
draws a hexagon happily in the centre of a screen. The vertices are in clockwise order starting from the top left (in this case, more top-centre, but the general rule is upper-leftmost), so it definitely does work. I'm not 100% sure about top-left being an absolute requirement, but I do know that clockwise is. I go with what's always worked, and top-left clockwise has never failed me. RE: drawPoly - Destiny's Player - 17-04-2015 Thanks for the help! On the first sleepy glance, your code is cleaner and has an easy to change scale feature. I'll look into it more tomorrow, but still, thanks a lot. Also, a small question. What's the purpose of the second render hook in the second-to-last row? |