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.

Newcomers AppGameKit Corner / Fill a sprite/polygon (2D)

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 11th Sep 2023 08:44 Edited at: 11th Sep 2023 09:19
Hi

I try to create a little "vector drawing" application.
I have found some functions to get the x/y point on a bezier curve, and it works fine (by baxslash).
So to draw the curve with stroke it's ok.

But, I try to fill the interior of the poygon.
I have found this great code by swissolo :
https://forum.thegamecreators.com/thread/211123

[edit : ok I have found the bug I have made, it's fixed ! I have inversed the last point ^^ (10h18)]
But I have a bug, a polygon isn't filled, I dont know why, as we can see on the screenshot.





Here is the code of the application (will be opensource) :


And a file if needed to test :



If you have an idea how I don' t have the last polygon filled, I will be very interested .

Another question : it's not very fast, so perhaps you know a better technic to fill a polygon, maybe with a spriteshader ?

thanks

EDIT :
What I would like to add :
- layer system with dim shape[] to add several shapes (to create character, objects and complete scene)
- add point between two existing point
- delete point
- export as image
- change stroke size and color
- change polygon color
- and perhaps other features
AGK2 tier1 - http://www.dracaena-studio.com

Attachments

Login to view attachments
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 11th Sep 2023 09:21
Ok, I have found my error , I have inversed the last point in the curve ^^

Bug fixed ! (code updated in the first message)
AGK2 tier1 - http://www.dracaena-studio.com
Aidan
User Banned
Posted: 11th Sep 2023 13:08
Correct it was something to do with not closing the shape
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Sep 2023 01:51
Wow! That looks awesome

Login to post a reply

Server time is: 2024-04-30 10:27:11
Your offset time is: 2024-04-30 10:27:11