|
Circle
Mar 1, 2022 9:23:15 GMT -6
Post by rosy on Mar 1, 2022 9:23:15 GMT -6
I was doing functions for my Basic C and compared the speed of drawing a circle, here is the RC code:
xmax = 640
ymax = 480
w=0
title$ = ""
center_x = windowpos_centered
center_y = windowpos_centered
WindowOpen(w,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),0)
SetWindowAutoClose(w, 0)
CanvasOpen(0,xmax,ymax,0,0,xmax,ymax,0)
Canvas(0)
ClearCanvas
t=timer
SetColor(-1)
for i=1 to 100000
circle(200,200,200)
next
print timer-t
Update 1. The program is silent, and after a few runs, even the system blew me (CircleFill works better). 2. I don't see in C basically the difference in execution speed for different algorithms for a circle. 3. My C function works much faster than RC for Circle r = 200, and for CircleFill, RC is a little faster.
Here are the different drawing algorithms:
P.S. It is even more interesting. CircleFill works 2x faster than Circle in RCBasic!
|
|
|
Circle
Mar 1, 2022 23:57:45 GMT -6
Post by n00b on Mar 1, 2022 23:57:45 GMT -6
That is interesting. I will probably take a look at my circle functions at some point to find out why the fill function is faster.
|
|
|
Circle
Mar 2, 2022 12:09:22 GMT -6
Post by rosy on Mar 2, 2022 12:09:22 GMT -6
It calls a lot of functions there, and that probably works in a few threads. The loop for ends, prints the time, but continues to draw, sometimes forever ...
|
|
|
Circle
Mar 5, 2022 2:19:57 GMT -6
Post by rosy on Mar 5, 2022 2:19:57 GMT -6
I made my own Circle, faster, simpler and more stable. Theses fonts, with scaling, color picker and inversion. I don't need SDL_gfx ...
|
|
|
Circle
Mar 5, 2022 23:48:10 GMT -6
Post by n00b on Mar 5, 2022 23:48:10 GMT -6
It calls a lot of functions there, and that probably works in a few threads. The loop for ends, prints the time, but continues to draw, sometimes forever ... Call Update() in your FOR loop I made my own Circle, faster, simpler and more stable. Theses fonts, with scaling, color picker and inversion. I don't need SDL_gfx ... Awesome. SDL_gfx could use some serious updating but its still really simple for people who are starting with SDL.
|
|
|
Circle
Mar 6, 2022 11:30:45 GMT -6
Post by rosy on Mar 6, 2022 11:30:45 GMT -6
In addition, my wheels are nicer ... However, there is a bug in SDL. Eg Line (10,100,10,100) draws 2 dots. Rectangles are terrible. Still, my wheels are OK, I don't know why ...
|
|