This is a very fast fake phong shaded circle drawing routine that can handle ovals and even cones (move the highlight to a point outside of the circle to produce cones) use it freely
# FAKE PHONG SHADED CIRCLES
open window 640, 512
circles = 255
sub pcircle(a,b,c,d,g,h)
doubpi = pi*2
x = a+c/g
y = b+d/h
f = pi/30
for e = f to doubpi step f
gtriangle x,y to a+cos(e)*c,b+sin(e)*d to a+cos(e+f)*c,b+sin(e+f)*d
next
end sub
label loop
setdispbuf draw
draw = 1 - draw
setdrawbuf draw
for c = 0 to circles
centerx = ran(640)
centery = ran(512)
radiusx = ran(50) + 25
radiusy = ran(50) + 25
r = ran(255)
g = ran(255)
b = ran(255)
l = ran(0.6)
setrgb 1, r, g, b
setrgb 2, l*r, l*g, l*b
setrgb 3, l*r, l*g, l*b
pcircle(centerx,centery, radiusx,radiusy, 3,-3)
next
goto loop
Here is the same routine but with an extra parameter that allows you to rotate the ovals
sub pcircle(a,b, c,d, g,h, r)
doubpi = pi*2
x = a + (c/g) * cos(r)
y = b + (d/h) * sin(r)
f = pi/30
for e = f+r to doubpi+r step f
gtriangle x,y to a+cos(e)*c,b+sin(e)*d to a+cos(e+f)*c,b+sin(e+f)*d
next
end sub