Poll: Do you _MapTriangle?
You do not have permission to vote in this poll.
I only use _MapTriangle because it is in the RotoZoom method.
25.00%
2 25.00%
I primarily use the 2D version (for applications other than RotoZoom).
37.50%
3 37.50%
I primarily use the 3D version for making true 3D programs and games. (Mastergy, should select this answer).
0%
0 0%
I don't use this method but I like to answer surveys.
37.50%
3 37.50%
Total 8 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do you _MAPTRIANGLE?
#11
If you have a 100x100 image, you can treat it like a 1000x100 image and draw it 10 times with one command... or two commands since you need two triangles. I checked the wiki to see if the feature was described, and I think a comment about achieving a  "tiling effect" was the only reference to it.

I mainly use it for scrolling backgrounds, but here's an example of how it works:

Code: (Select All)
scr = _NewImage(1000, 600, 32)

Screen scr


'DRAW SINGLE SMALL TILE

'---------------------

img = _NewImage(40, 100, 32)

_Dest img

Line (0, 0)-(20, 50), _RGB32(128, 0, 0), BF
Line (21, 0)-(40, 50), _RGB32(255, 0, 0), BF
Line (21, 51)-(40, 100), _RGB32(128, 0, 0), BF
Line (0, 51)-(20, 100), _RGB32(255, 0, 0), BF

'----------------------


'FILL ENTIRE SCREEN WITH MAPTRIANGLE

_MapTriangle (0, 0)-(1000, 0)-(0, 600), img To(0, 0)-(1000, 0)-(0, 600), scr
_MapTriangle (0, 600)-(1000, 600)-(1000, 0), img To(0, 600)-(1000, 600)-(1000, 0), scr
Reply
#12
How about a round magnifying glass effect?

Code: (Select All)
i& = _ScreenImage

_Delay .5
Screen _NewImage(_DesktopWidth, _DesktopHeight, 32)

stp = _Pi(2) / 30

While i$ <> Chr$(27)
    While _MouseInput: Wend
    mx = _MouseX
    my = _MouseY
    i$ = InKey$
    _PutImage , i&
    For c = 0 To _Pi(2) Step stp
        sx = mx + Cos(c) * 30
        sy = my + Sin(c) * 30
        sx2 = mx + Cos(c + stp) * 30
        sy2 = my + Sin(c + stp) * 30

        dx = mx + Cos(c) * 90
        dy = my + Sin(c) * 90
        dx2 = mx + Cos(c + stp) * 90
        dy2 = my + Sin(c + stp) * 90

        _MapTriangle (mx, my)-(sx, sy)-(sx2, sy2), i& To(mx, my)-(dx, dy)-(dx2, dy2), 0, _Smooth
    Next c
    _Display
Wend


Reply
#13
You can do different effects with it...

Code: (Select All)
i& = _ScreenImage

_Delay .5
Screen _NewImage(_DesktopWidth, _DesktopHeight, 32)

stp = _Pi(2) / 30
ir = 4
vr = 7



While i$ <> Chr$(27)
    i$ = InKey$
    _PutImage , i&
    mx = _DesktopWidth / 2
    my = _DesktopHeight / 2
    For c = 0 To _Pi(2) Step stp
        sx = mx + Cos(c) * ir
        sy = my + Sin(c) * ir
        sx2 = mx + Cos(c + stp) * ir
        sy2 = my + Sin(c + stp) * ir

        dx = mx + Cos(c) * vr
        dy = my + Sin(c) * vr
        dx2 = mx + Cos(c + stp) * vr
        dy2 = my + Sin(c + stp) * vr

        _MapTriangle (mx, my)-(sx, sy)-(sx2, sy2), i& To(mx, my)-(dx, dy)-(dx2, dy2), 0, _Smooth
    Next c
    ir = ir + 3
    vr = vr + 2
    _FreeImage i&
    i& = _CopyImage(0, 32)
    _Display
    _Limit 20
Wend


Reply
#14
Excellent, thanks for the examples!  I’ll add them to the test cases.
Reply
#15
Thumbs Up 
Cool! That checkered thing surprised me! I was expecting a Full Screen 4 checkers image.
b = b + ...
Reply
#16
Thank you to everyone that participated in this survey and provided examples!  Based on the feedback that's been received I've learned the following:
  1. Most people don't answer surveys.
    This not an effective way to measure utilization of a particular feature.

  2. _MapTriangle is used a lot for doing higher level 2D graphics functions that there are not specific QB64 functions for (e.g. RotoZoom, FillTriangle).
    I'm looking at adding an extended 2D graphics library for QBJS that will provide native support for these and a few other high-level graphics methods.

  3. People who use the 3D version of _MapTriangle operate on a plane beyond surveys.

   
Reply
#17
The option was missing - I use both, always as needed.


Reply




Users browsing this thread: 1 Guest(s)