Mail Archives: djgpp/1999/03/15/09:52:39
The Beyonder writes:
> after visiting a site on how to draw primitive shapes to the screen,
> I decided to try this circle technique. It said to first generate a
> trigonomitry table full of sin_acos info?
I can't comment on why this doesn't work (as someone else said, it
looks like an FPU emulation bug), but I'd just like to point out that
this is not a good method for drawing circles. Trig calls are the
obvious but uncool way to do it, and suffer from a lot of problems
like rounding errors causing ugly blobs around the perimeter, and
having to overdraw the same pixel several times (this is slow, and
will cause major problems if you ever want to use an XOR or
translucent drawing mode).
The Bresenham circle algorithm works entirely in integer units, with
perfect accuracy and no pixel overdraw. For details, see
http://www.heim2.tu-clausthal.de/PROJEKT/PRG/PCGAMES/bres.html,
or the do_circle() function from the Allegro source file gfx.c.
Shawn Hargreaves.
- Raw text -