Author Topic: Mapping a texture to a cube's faces  (Read 3985 times)

0 Members and 1 Guest are viewing this topic.

Offline Aureal

  • Newbie
  • Posts: 17
  • memes
    • View Profile
Mapping a texture to a cube's faces
« on: March 27, 2018, 01:54:52 pm »
Knowing both x and y co-ordinates (which have already been projected from 3D space) of every vertex of the cube, how would I map a texture to its face(s)? I've seen examples using _MAPTRIANGLE, but I'm not sure whether I have to use it, neither how to, can I get some help?
I've attached an image for reference
« Last Edit: March 27, 2018, 02:02:26 pm by Aureal »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Mapping a texture to a cube's faces
« Reply #1 on: March 27, 2018, 02:05:32 pm »
Hello,

I solved this a few years ago by stitching two instances of _MAPTRIANGLE together. There is probably a better way to do it, and the math got a little heavy - as the program otherwise is designed for QB45/SCREEN 12. (Take away _MAPTRIANGLE and it's back to solid colors or wireframe.)

I think I called it QUADLAND or something on the *.net forums. I can dig it out if we need, but I'm hoping there is an easier way by using GL commands more directly.
You're not done when it works, you're done when it's right.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Mapping a texture to a cube's faces
« Reply #2 on: March 28, 2018, 04:06:11 am »
Hi Aureal. Try look to Galleon´s code here: http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=12257.0 he use _MAPTRIANGLE for texturing in this program.