From: "Elias Pschernig" Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro Texture Mapping Date: Mon, 27 Apr 1998 09:28:13 +0200 Organization: magnet Internet Services Lines: 48 Message-ID: <6i2nmo$sk8$1@orudios.magnet.at> References: <1998042700340800 DOT UAA14329 AT ladder03 DOT news DOT aol DOT com> NNTP-Posting-Host: 195.3.67.142 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk <1998042700340800 DOT UAA14329 AT ladder03 DOT news DOT aol DOT com>...wrote >I'm just beginning to mess with Allegro 3d routines and am quite oblivious to >most 3d material. >I've taken the example source ex25.c and modified it. >I've given the array u and v values of zero, and loaded a 32x32 bitmap, changed >POLYTYPE_FLAT to POLYTYPE_ATEX, gotten rid of the c value, and changed NULL to >the bitmap name, and according to the documentation, this would map the bitmap >onto the squares. > >Instead, it takes the first pixel (upper left) of the bitmap and colors the >squares accordingly, instead of mapping the entire bitmap onto each square. > >Can someone tell me what I'm missing? Is this too vauge? Here's the parts of >code I've changed... > >for(c=0;c<4;c++) { > v[c].u=1; > v[c].v=1; > } >/* v[0].c = ((x + z) & 1) ? 2 : 3;*/ > >quad3d_f(bmp, POLYTYPE_ATEX, textr, &v[0], &v[1], &v[2], &v[3]); > >(textr is the name of a 32x32 bitmap) > yea, the docs that came with allegro are not as good as allgro itself, i had the same problem a week ago, and needed some time to figure this out too. dont know how, but after an hour or so i found the mistake: what you did is, you mapped only the pixel at (1,1) to your squares. you need to set up the 4 vertices to 4 points inside you texture, so instead of your for-loop you have to do: v[0].u=0;v[0].v=0; v[1].u=31;v[1].v=0; v[2].u=31;v[2].v=31; v[3].u=0;v[3].v=31; happy ALLEGRO-programming, Elias Pschernig