From: qballlives AT aol DOT com (QBallLives) Newsgroups: comp.os.msdos.djgpp Subject: Re: 3D beginner (Allegro) Date: 22 Mar 1998 18:34:35 GMT Lines: 70 Message-ID: <1998032218343500.NAA22226@ladder03.news.aol.com> NNTP-Posting-Host: ladder03.news.aol.com Organization: AOL http://www.aol.com References: <3513FE25 DOT 62D5 AT club-internet DOT fr> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk > >New to 3D I have a few questions. > >In the 3d world when shapes have negatives values(for z negatif) the >perspective projection draws lines not the way we expect them.(they >cross one another)What can I do to enter z<0 values?(I use Allegro) > >When you calculate (x,y,z) values rotating a shape, the shape doesn't >seem constant.For instance going left and after coming back right the >shape doesn't come back at the same place.What is my mistake?Do I have >to calculate the new coord using the first one entered,or must I use >last coord.(this way tiny errors become none tiny after several >calculations!). > >Using Allegro, in rotation you must enter angles "in binary, 256 degrees >to a circle format".What does that meen? >What does this do: itofix(1) & itofix(256).Why can't we just enter an >angle? > >Thanks for your help. > > > > I have a couple of those answers.... see... Allegro (version 3 at least) provides both FIXED POINT and floating point versions of many of the polygon functions.... itofix merely takes it's input... 256 in your example... and makes it a fixed point number... I think 16:16 fixed point.... Allegro... at least the example program I've messed with... does everything fixed point.... from the object's local vertices... to it's world position -> to YOUR (the viewpoint's) position in the universe.... Now about the -Z thing.... Allegro... as it stands now.... doesn't come equiped with OBJECT CULLING.... or Z clipping.... I'm sure you can find those components by surfing the Allegro webring.... Part of ridding yourself of that nasty crossover at -Z values is to CULL objects.... remove them... so that the engine doesn't attempt to render them... To determine whether to do that to an object, a good idea is to come up with the RADIUS of the object.... (if you need code... I have some.... but it might take work to incorporate it into Allegro... because it's from another lib) Using that radius... you can determine if an object is outside of the viewing FRUSTRUM - or is it FUSTRUM? That takes care of an object being behind you..... but what if it's part in front, part behind? The simplest way for now.... is to NOT DRAW a poly with any points closer than say... 50 units... (which'd probably be itofix(50) ; ) Gotta run - but have fun - w/ Allegro 3 If you can't find a site participating in the allegro webring - goto http://www.webring.org.... and find it... Jim the loiterer aloiterer AT juno DOT com http://www.fortunecity.com/skyscraper/gigahertz/179/index.html