Author Topic: texture mapping to an arbitrary 4 sided polygon  (Read 3848 times)

0 Members and 1 Guest are viewing this topic.

Offline zparticle

  • Atari ST
  • ***
  • Posts: 168
  • Karma: 11
    • View Profile
    • ScottShaver2000
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.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: texture mapping to an arbitrary 4 sided polygon
« Reply #1 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
Challenge Trophies Won:

Offline zparticle

  • Atari ST
  • ***
  • Posts: 168
  • Karma: 11
    • View Profile
    • ScottShaver2000
Re: texture mapping to an arbitrary 4 sided polygon
« Reply #2 on: November 02, 2006 »
Thanks Jim, I'll take a look.

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: texture mapping to an arbitrary 4 sided polygon
« Reply #3 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)

Challenge Trophies Won: