Author Topic: _MAPTRIANGLE3D Display Order Curiosity  (Read 2462 times)

0 Members and 1 Guest are viewing this topic.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
_MAPTRIANGLE3D Display Order Curiosity
« on: January 20, 2019, 06:47:55 am »
If Code has the following form:

Code: QB64: [Select]
  1. _PUTIMAGE(x1,y1)-(x2,y2), Image1&
  2. _PUTIMAGE(x1,y1)-(x2,y2), Image2&
  3. _PUTIMAGE(x1,y1)-(x2,y2), Image3&

followed by _DISPLAY, the images are placed on the screen in the order Image1&, Image2&, Image3&, and Image2& is on top of Image1& and occludes it (as you would expect), and Image3& is on top of Image2& and occludes it and Image1& (as you would expect).

I found a curiosity with _MAPTRIANGLE3D, where the opposite happens:

Code: QB64: [Select]
  1. _MAPTRIANGLE(a,b)-(c,d)-(e,f), Image1& TO(x1,y1,z)-(x2,y2,z)-(x3,y3,z)
  2. _MAPTRIANGLE(a,b)-(c,d)-(e,f), Image2& TO(x1,y1,z)-(x2,y2,z)-(x3,y3,z)
  3. _MAPTRIANGLE(a,b)-(c,d)-(e,f), Image3& TO(x1,y1,z)-(x2,y2,z)-(x3,y3,z)

followed by _DISPLAY puts Image2& on top of Image3&, and Image1& on top of Image2& and Image3&.

Note that all images have the same z value and are all in the same z- plane.  If z- values differ, then the images will be placed in z- value order (lowest z-, ie furthest away, first).

This opposite ordering is a curiosity, and I've learnt to change the code order for _MAPTRIANGLE3D.

Do the parameters _CLOCKWISE /_ANTICLOCKWISE have any effect upon this?  I have never used _CLOCKWISE /_ANTICLOCKWISE, as I cannot fathom what is the "thing" that is going anticlockwise or clockwise.  You are just writing images to the screen in a particular order.


Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: _MAPTRIANGLE3D Display Order Curiosity
« Reply #1 on: January 20, 2019, 08:34:43 am »
I think when you are placing image with _MAPTRIANGLE for the same coordinate, the image which is placed after the first image get discarded by OpenGL as it will confuse it decide what to show on the screen.

if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: _MAPTRIANGLE3D Display Order Curiosity
« Reply #2 on: January 20, 2019, 01:48:27 pm »
I agree with Ashish because the 3D MapTriangle texture introduces the opengl command (_glBindTexture). Apparently, the release will only occur after you call _DISPLAY, which displays the entire scene. But texture can be overwritten, as shown by my cube demonstration.

Those parameters _CLOCKWISE and _ANTICLOCKWISE - so I'll say so this way. I suspect they are working poorly. But it has happened many times that it was a my bug, so unless I'm quite sure I will not report this as bug. In my opinion, this is what to do: Imagine an open cube that rotates in space. You need the texture another inside and another from outside. Maybe in case you model a house with a transparent window to see it in. And these parameters should ensure that the triangle will be textured from outside if you see outside wall and if you see the same wall from second side, is then textured from inside with other texture. So, that is my idea that I will deal with in the future with other Maptriangle programs. Is possible that my idea about CLOCKWISE and ANTICLOCKWISE is wrong, then I ask the developer to clarify what these parameters are exactly in the practical programming.