From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: all is polygon in Allegro?? Date: Wed, 14 Jan 1998 19:07:41 +0000 Organization: None Distribution: world Message-ID: References: <34BD43D5 DOT EA2F15B4 AT laon DOT inra DOT fr> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 28 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Victor jetten writes: >a) if you look at commands like triangle, quad etc, all functions call >polygon with 3 edges, 4 edges etc. I agree that this ellegant, but is it >fast? It seems that this would use a lot of unnecessary overhead. Is >this so? Not really, since the triangle and quad functions are very simple wrappers around the generic polygon routines. I use a very dodgy assumption about the stack layout to avoid having to copy the parameters into a new structure, so there is very little overhead in this. >b) in polygon.c all drawing routines, float or fixed, are converted to >fixed point in the structure POLYGON_EDGE. Not quite all. The u, v, and z values for perspective correct texture mapping are manipulated as floats, the rest as integer or fixed point. This is very simply because it is faster that way, and minimises the float->int conversions in the scanline plotters. It would certainly be possible to make a much faster dedicated triangle plotter, but that is the nature of library code. Allegro needs to handle a wide range of possible situations, and there is inevitably some overhead associated with that... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ "Pigs use it for a tambourine" - Frank Zappa