Search
Setup for Free
S
Silk.NET
•
5y ago
Deleted User
MY RENDERER's circle rendering code is...complicated
MY RENDERER
's circle rendering code is
.
.
.complicated
Silk.NET
Join
A Discord server for the Silk.NET - your one-stop-shop for high-speed .NET multimedia, graphics, and compute. FOSS.
1,787
Members
View on Discord
Similar Threads
Was this page helpful?
Yes
No
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
D
Deleted User
OP
•
8/14/21, 10:57 AM
because it
's a port
(with permission
) of someone else
'ss circle rendering code that was written for monogame
D
Deleted User
OP
•
8/14/21, 10:57 AM
And I do NOT understand the mental witchcraft that thing does so like
D
Deleted User
OP
•
8/14/21, 10:57 AM
I just
D
Deleted User
OP
•
8/14/21, 10:57 AM
don
't touch it
D
Deleted User
OP
•
8/14/21, 10:58 AM
it crashes the engine sometimes
D
Deleted User
OP
•
8/14/21, 10:58 AM
I need better circle rendering code
D
Deleted User
OP
•
8/14/21, 11:01 AM
this is the colossal mess that is that circle code
D
Deleted User
OP
•
8/14/21, 11:01 AM
message.txt
5.32KB
D
Deleted User
OP
•
8/14/21, 11:02 AM
I had to hack in texture support
D
Deleted User
OP
•
8/14/21, 11:02 AM
so I can render profile pictures in my game with rounding
, because non
-rounded profile pictures are a relic of the feckin 1400s
D
Deleted User
OP
•
8/14/21, 11:04 AM
part of the issue is
maxError
maxError
defaults to an insanely low value
, but
D
Deleted User
OP
•
8/14/21, 11:04 AM
the engine crashes more often the higher that value is defaulted to
D
Deleted User
OP
•
8/14/21, 11:08 AM
this is where it crashes
D
Deleted User
OP
•
8/14/21, 11:08 AM
D
Deleted User
MY RENDERER's circle rendering code is...complicated
Q
queenvicky
•
8/14/21, 11:28 AM
can I see your circle rendering code
? Probably just beziers I believe
D
Deleted User
OP
•
8/14/21, 11:31 AM
see above
D
Deleted User
OP
•
8/14/21, 11:31 AM
I posted it
Q
queenvicky
•
8/14/21, 11:31 AM
can
't find it
. The
FillCircle
FillCircle
methods just call other fill circle methods
.
Q
queenvicky
•
8/14/21, 11:31 AM
or I don
't understand it
- which is more likely
D
Deleted User
OP
•
8/14/21, 11:32 AM
Discord trims the file down on my end
D
Deleted User
OP
•
8/14/21, 11:32 AM
try downloading it
D
Deleted User
OP
•
8/14/21, 11:32 AM
Oh it
's an unbound stack alloc
!
D
Deleted User
OP
•
8/14/21, 11:32 AM
I accidentally pasted a stupidly long text rendering function in with it
, my bad
D
Deleted User
OP
•
8/14/21, 11:32 AM
That
's a good idea
D
Deleted User
OP
•
8/14/21, 11:32 AM
Likely that
's what the crashes are from
D
Deleted User
OP
•
8/14/21, 11:33 AM
Crashing
's from an index range exception
D
Deleted User
OP
•
8/14/21, 11:33 AM
Oh ok what
D
Deleted User
OP
•
8/14/21, 11:33 AM
If you want I can take a closer look at my PC later
D
Deleted User
OP
•
8/14/21, 11:33 AM
Workaround is to round the radius of the circle before computing the error value
T
TechPizza
•
8/14/21, 11:34 AM
i think i have an enumerator struct somewhere that enumerates points of a circle edge
D
Deleted User
OP
•
8/14/21, 11:35 AM
It
's pretty simple to calculate n numbers laying on a circle equally spaced apart
T
TechPizza
•
8/14/21, 11:35 AM
oh even better
, it
's an EllipseEnumerable
D
Deleted User
OP
•
8/14/21, 11:37 AM
Once I started rounding the radius to the nearest whole number
, I could safely set the error much higher without the engine ever crashing
D
Deleted User
OP
•
8/14/21, 11:37 AM
and now I went from 100 FPS when there
's a circle on screen to uh
D
Deleted User
OP
•
8/14/21, 11:38 AM
2000
T
TechPizza
•
8/14/21, 11:38 AM
https://github.com/TechnologicalPizza/MonoGame/blob/develop/MonoGame.Framework/Graphics/Sprites/SpriteBatchShapeExtensions.cs
enumerators
= no stackallocs
:
)
D
Deleted User
OP
•
8/14/21, 11:38 AM
what
's wrong with stackalloc though
D
Deleted User
what's wrong with stackalloc though
T
TechPizza
•
8/14/21, 11:38 AM
we don
't have unlimited memory
+ it
's usually cleared if you dont have
[SkipLocalsInit
]
D
Deleted User
OP
•
8/14/21, 11:39 AM
no stackalloc is great
D
Deleted User
OP
•
8/14/21, 11:39 AM
but if you have it unbound
, like in your case
D
Deleted User
OP
•
8/14/21, 11:39 AM
it can happen that you allocate 10000 bytes on the stack
T
TechPizza
•
8/14/21, 11:39 AM
although i doubt clearing is slower than a slightly branching enumerator
D
Deleted User
OP
•
8/14/21, 11:39 AM
and that will throw StackOverflow
, which is uncatchable and effectively terminates your app
D
Deleted User
OP
•
8/14/21, 11:40 AM
yeahhh I
've gotten StackOverflow with significantly low maxError values
T
TechPizza
•
8/14/21, 11:40 AM
the limit is way more than 10kB but yeah
, you have to control it somehow
D
Deleted User
yeahhh I've gotten StackOverflow with significantly low maxError values
T
TechPizza
•
8/14/21, 11:40 AM
considering that there
's usually 2MB of stack
, i think you got
way
too many points there
:
)
D
Deleted User
OP
•
8/14/21, 11:41 AM
Yeahhhhhhhhhhhhhhhhh
D
Deleted User
OP
•
8/14/21, 11:41 AM
also why are you passing a Span
<Vector2
> by
ref
ref
?
D
Deleted User
OP
•
8/14/21, 11:41 AM
Ellipses are definitely something thundershock needs too
D
Deleted User
OP
•
8/14/21, 11:41 AM
Or rather
, a way to draw a circle that
's basically just uh
Next page
maxError
maxError
FillCircle
FillCircle
Similar Threads
State of code gen
S
Silk.NET / help-and-questions
4y ago
CI + dotnet tooling is just... different
S
Silk.NET / team-talk
4y ago