• Welcome to Dark Bit Factory & Gravity.
 

texture mapping to an arbitrary 4 sided polygon

Started by zparticle, October 31, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zparticle

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.

Jim

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
Challenge Trophies Won:

zparticle


relsoft

Interpolation should work as lone as you know the UV coords, you could paste any texure to any poly.

texel = (minu + maxu/length)

Challenge Trophies Won: