Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: zparticle on October 31, 2006

Title: texture mapping to an arbitrary 4 sided polygon
Post by: zparticle on October 31, 2006
Need a little help here. I would like a description or sample code of how to determine where in an arbitrary 4 sided polygon to place a pixel from a retangular source image.  This is in plain 2D not 3D so nothing fancy is needed it just needs to not leave holes.
Title: Re: texture mapping to an arbitrary 4 sided polygon
Post by: Jim on November 01, 2006
Truly the simplest and best technique is to use one of the texturemapped triangle routines that's been posted here, and use it to draw a couple of tris to make your quad.  Even though they might sound like 3D, in fact the triangle rendering is always in 2D (so it can be drawn on the screen).
If you can't find a suitable one, let me know what language you're using and I'll port one on mine for you.

Jim
Title: Re: texture mapping to an arbitrary 4 sided polygon
Post by: zparticle on November 02, 2006
Thanks Jim, I'll take a look.
Title: Re: texture mapping to an arbitrary 4 sided polygon
Post by: relsoft on November 14, 2006
Interpolation should work as lone as you know the UV coords, you could paste any texure to any poly.

texel = (minu + maxu/length)