QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Qwerkey on August 13, 2018, 10:38:51 am

Title: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: Qwerkey on August 13, 2018, 10:38:51 am
I've just started writing some code which requires_MAPTRIANGLE (3D), and the program fails if the image is not hardware-accelerated.

In a 32-bit Screen, the following code fails "Illegal Function" at run time

Code: QB64: [Select]
  1. _MAPTRIANGLE (99, 99)-(0, 99)-(99, 0), Earth& TO(-100, -100, -400)-(-200, -100, -400)-(-100, 0, -400)

if the Image "Earth&" is a software image  - eg Earth& = _LOADIMAGE("The Earth.png", 32)

But the same code works as expected if the image is hardware-accelerated - eg Earth& = _LOADIMAGE("The Earth.png", 33)

There appears to be no restriction in the Wiki.

Richard

Title: Re: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: FellippeHeitor on August 13, 2018, 11:14:25 am
I have successfully used _MAPTRIANGLE before with software images. Please check and try to run the code I provided here: https://www.qb64.org/forum/index.php?topic=397.msg2740#msg2740

It simply loads an image (and never converts it to hardware mode) and _MAPTRIANGLE deals with it just fine.

Please let us know if that works on your system.

Now are you using InForm? Make sure to use BeginDraw and EndDraw methods (https://github.com/FellippeHeitor/InForm/wiki/PictureBox-Drawing) before attempting to draw to a PictureBox control (I'm asking after having briefly skimmed through your last email).
Title: Re: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: Petr on August 13, 2018, 12:17:31 pm
Hi. You use Z coordinate. For using maptriangle with Z muss image be hardware type.
Title: Re: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: FellippeHeitor on August 13, 2018, 12:19:27 pm
Aha! Eyes of an eagle, Petr!
Title: Re: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: Qwerkey on August 13, 2018, 12:43:46 pm
Thank you Petr, I imagined from it not working that this must be the case.  Unless I cannot understand correctly, the Wiki does not preclude software imaging from _MAPTRIANGLE(3D) - with z- coordinates - although the example given uses a hardware image.  For Fellippe's information, this will be part of an InForm program, though I am merely investigating at the  moment and have not used InForm here at the moment.

Would there be a reason why _MAPTRIAMGLE(3D) only works with hardware imaging?  What the processor/graphics card produces is a 2D image, so the two things would not appear to be related, but this will be another thing beyond my comprehension.

Richard
Title: Re: Is _MAPTRIANGLE (3D) Illegal for 32-bit Software Images
Post by: Petr on August 13, 2018, 01:14:40 pm
I do not know the details, but apparently it will be due to the OPENGL commands, because using 3D, 3D OpenGL commands are definitely called. This is maybe based on the fact that three vertex of _glvertex3f are defined for 3D texture display in OpenGL, which apparently will get QB64 from the maptriangle command and then call openGL commands to load the image as a texture. I suppose this is to distinguish images used for 3D OpenGL and 2D openGL. But do not take it as a fact, i just think that.