Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 14 15 16 17 18 Next »
drawPoly
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
drawPoly
17-04-2015, 09:49 PM,
#6
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: drawPoly
The following code:

local function MakeHexagon( X, Y, W, H )
return {
render.vertex( X, Y - H * 0.5 ),
render.vertex( X + W * 0.5, Y - H * 0.25 ),
render.vertex( X + W * 0.5, Y + H * 0.25 ),
render.vertex( X, Y + H * 0.5 ),
render.vertex( X - W * 0.5, Y + H * 0.25 ),
render.vertex( X - W * 0.5, Y - H * 0.25 )
}
end

local Poly = MakeHexagon( 256, 256, 128, 128 )
hook( "render", "bleh", function()
render.clear( 0, 0, 0, 255 )

render.setTexture()
render.setColor( 255, 255, 255 )

render.drawPoly( Poly )

hook( "render", "bleh" )
end )

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.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
drawPoly - by Destiny's Player - 16-04-2015, 09:05 PM
RE: drawPoly - by LocInt - 16-04-2015, 10:18 PM
RE: drawPoly - by Destiny's Player - 17-04-2015, 06:09 AM
RE: drawPoly - by Person8880 - 17-04-2015, 06:12 PM
RE: drawPoly - by Destiny's Player - 17-04-2015, 08:51 PM
RE: drawPoly - by Person8880 - 17-04-2015, 09:49 PM
RE: drawPoly - by Destiny's Player - 17-04-2015, 09:53 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.