www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/10:33:31

From: Shawn Hargreaves <shawn AT talula DOT demon DOT co DOT uk>
To: djgpp AT delorie DOT com
MMDF-Warning: Parse error in original version of preceding line at punt-1.mail.demon.net
Subject: Re: triangle3d() and POLYTYPE_ATEX in Allegro
Date: Fri, 9 May 1997 11:31:17 +0100
MIME-Version: 1.0
Message-ID: <863183525.052943.0@[194.129.18.166]>

KaRNaGE writes:
> triangle3d() displays ALL black polygons...i know all the coordinates are
> right because when i use POLYTYPE_FLAT or POLYTYPE_GCOL...it looks real
> good (shading is correct and everything)..i'm problay forgetting
something
> stupid....BTW V3D_temp[?].u and .v texture coordinates are set to 0....i

That's the problem: you must set the u and v coordinates to use texture
mapping. They control which way up the texture is, and how it is stretched
or tiled, so if you just set them to zero you will get the top left pixel
of your texture stretched across the entire polygon. You should give one of
your vertices a zero u/v position, one a u that is the width of your
texture, one a v that is the height of your texture, and one a position of
u=w, v=h, assuming that you are drawing a quad. With triangles, pick which
corners of the texture you want to use for each vertex, or choose points
inside the texture to only use a part of it, or points outside the texture
to tile it: it's up to you, but the values do need to be set. 

For an example of this, look at how the quad() function in ex22.c sets up
the four polygon vertices...

> also used create_rgb_table() and create_light_table(), before these calls
> to triangle3d()....

Those aren't needed for the ATEX render mode. You need a light table if you
are going to use the ATEX_LIT or PTEX_LIT modes, and an RGB table if you
are going to use the GRGB mode, but the standard texture mapping routines
don't need any lookup data...


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019