From: ovek AT arcticnet DOT no (Ove Kaaven) Newsgroups: comp.os.msdos.djgpp Subject: Allegro perspective-correct texture mapping Date: Mon, 03 Mar 1997 12:41:00 GMT Organization: Vplan Programvare AS Lines: 40 Message-ID: <5fg3s0$hob$1@troll.powertech.no> NNTP-Posting-Host: alwayscold.darkness.arcticnet.no To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Okay, for some reason, my workspace recently got invaded by a friend, who seemed to be interested in making games. So it was time to put my copy of the excellent game library Allegro to work. After having spent a couple of days trying it out by making a shoot-the-target program (which he says made a "hit" on the school lab he installed it on), we moved on to Allegro 2.2's 3D features. After 2-3 days of work, I wrote the necessary code for arbitrary texture mapping with view volume clipping etc. However, there is a couple of issues I was wondering about. 1. Using POLYTYPE_PTEX, polygon3d_f bombs with SIGFPE when looking at my (vertical) wall at extremely small angles (wall and camera ray almost parallel). Here's a traceback, just in case. Floating Point exception at eip=00018166 eax=0a090209 ebx=0134302b ecx=00000001 edx=01970922 esi=0009e004 edi=000c2784 ebp=00083cd0 esp=00083c88 program=C:\DJGPP\SNIPER\SNIPER.EXE [some irrelevant selectors] Call frame traceback EIPs: 0x00018166 __poly_scanline_ptex+514 0x000066ab _triangle+3135 I realize that this is probably a floating-point overflow, but is there a good way around it? 2. The perspective-correct mapping is also somewhat slower than what's appropriate for games like Doom or Duke3D. By looking at the Allegro sources, it seems to be calculating scanlines the 'traditional' way. Are there plans to provide optimized routines for horizontal and vertical surfaces, or even better, the method described in zed3d (letting the logical scanlines you map onto be slanted themselves) to have a very fast perspective mapper? 3. What should I give Shawn for his excellent library? 4. Where should I post this to keep it from being off-topic?