From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with Allegro 3d transformations Date: Sun, 13 Jul 1997 09:59:58 +0100 Organization: None Distribution: world Message-ID: <18MOrEAOkJyzEwxz@talula.demon.co.uk> References: <970712205937_100661 DOT 1576_EHV51-1 AT CompuServe DOT COM> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 35 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Wayne Davidson writes: > I am realively new to Allegro, as well as 3D graphics, and >I am trying to write a program that does 3d graphics, and I don't seem >to get the right results. I call persp_project() and it returns >numbers that seem way off the wall, or is it that I am not using RHIDE >correctly?. How you use Rhide won't affect what your program does, once compiled! > rx(0),ry(0),rz(0){x=160;y=100;z=50;} There's a major part of the problem. The X and Y coordinates should be zero, because the default camera is at the origin. The size of the screen only has meaning after you've done the perspective projection into 2d coordinates, it's not important while you are working in 3d space... >vertex_type points[] = /* a cube, centered on the origin */ >{ > /* vertices of the cube */ > { -32, -32,-32, And there's the other part. You are failing to scale these numbers up into fixed point format, so you are initialising your points with some really _tiny_ values! Try using 32<<16 instead. With those changes, your program works fine, except that some of the lines run diagonally rather than along the edges of the cube. But that's just a matter of what order you hook the vertices up in, which should be easy to fix... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.