Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - [Matrix1Utils] Draw filled polygons from a list of vertices

Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 1st Jun 2011 15:56 Edited at: 1st Jun 2011 17:53
Well, after a little headache (and some borrowing from the blitzmax forum ), I have compiled a piece of code that I think is rather yummy.

It allows you to create and draw filled (or unfilled) polygons with any number of sides, and in any irregular shape you can imagine.

I wanted to limit the number of plugins required to use it (Matrix1Utils is a given, sorry! I refuse to code in DBP without it), so it draws using DBP dots by default. But, if you have Advanced2D or D3DFunc installed, you just have to do some little comment switcherooskis in LineFunction() and TriangleFunction() and performance increases dramatically.

Now teh codez:

I am not the best at commenting code, so if you have any questions about what's going on in here, let me know.


Decided to make a non-Matrix1Util version and clean the code up a bit

I *think* I got rid of all of the Matrix1 commands...

TTYL Apillo

May 10th / Jerico2day-OBese87 / VOTE NOW
French gui
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 4th Jun 2011 20:11 Edited at: 4th Jun 2011 20:15
Well done Jimmz! A bit slow when lots of poly or big ones are drawn but I 'll try to use advanced 2D. Thanks for sharing this.

Login to post a reply

Server time is: 2023-03-26 14:20:37
Your offset time is: 2023-03-26 14:20:37