CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    i'm trying now testing the function:
    Code:
    'Convert all 3D vectors to 2D vectors(for screen):    Dim i As Integer
        For i = 0 To 3
            Points(i) = ConvertPositon3DTo2D(NewPosition3D(i), WorldSize)
        Next i
        
        'change the brush and pen:
        'FillStyle = vbFSSolid
        'FillColor = vbRed
        
        
        DrawStyle = DrawStyleConstants.vbInvisible
        Polygon Me.hDC, Points(0), 4
        Dim points2(4) As POINTAPI
        points2(0) = Points(0)
        points2(1) = Points(1)
        points2(2) = Points(2)
        points2(3) = Points(3)
        PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth  , Picture1.ScaleHeight  , &O0, &O0, &O0
    i did several tests but i only get like a line on a diagonal
    i changed the points but i continue with bad results.
    the points order:
    - points(0) is the low-left;
    - points(1) is the upper-left;
    - points(2) is the upper-right;
    - points(3) is the low-right;
    and yes i did too:
    Code:
     points2(0) = Points(1)
        points2(1) = Points(2)
        points2(2) = Points(3)
        points2(3) = Points(0)
    but i get diagonal white line result
    so what i'm doing wrong?

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: how use PlgBlt() API function?

    Did you try
    Code:
     PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth  , Picture1.ScaleHeight  , &O0, &O0, &O0
    Last edited by Arjay; September 23rd, 2020 at 07:51 AM. Reason: Fixed up ending code tag
    Victor Nijegorodov

  3. #18
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    yes
    Code:
     Dim points2(4) As POINTAPI
    points2(0) = Points(0)
        points2(1) = Points(1)
        points2(2) = Points(2)
        points2(3) = Points(3)
        PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
    Last edited by Cambalinho; September 23rd, 2020 at 05:24 AM.

  4. #19
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: how use PlgBlt() API function?

    Quote Originally Posted by Cambalinho View Post
    yes
    Code:
     Dim points2(4) As POINTAPI
    points2(0) = Points(0)
        points2(1) = Points(1)
        points2(2) = Points(2)
        points2(3) = Points(3)
        PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
    Your 2nd param is different than the points2 param that Victor suggested (points2(0) is not points2).

  5. #20
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    Code:
    PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
    error by ref argument....

  6. #21
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: how use PlgBlt() API function?

    Quote Originally Posted by Cambalinho View Post
    Code:
    PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
    error by ref argument....
    Then sorry! I just thought in C++ categories.
    Victor Nijegorodov

  7. #22
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    correct me anotherthing: even if i fix it, the PlgBlt() can be used on a plane? or the results will be not what we expected?
    i mean drawed the texture.. like create a street

  8. #23
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    finally i'm using it, but i'm getting the wrong shape width..
    Code:
    'Get the four vectors
        'Floor:
        'Vector1: low-left
        FillPosition3D NewPosition3D(0), Position.X, Position.Y, Position.Z
        NewPosition3D(0) = Rotate(NewPosition3D(0), Rotation, RotatedPosition)
        
        
        'Vector2: upper-left
        FillPosition3D NewPosition3D(1), Position.X, Position.Y, Position.Z + Size.ZDepth
        NewPosition3D(1) = Rotate(NewPosition3D(1), Rotation, RotatedPosition)
        
        'Vector3: upper-right
        FillPosition3D NewPosition3D(2), Position.X + Size.Width, Position.Y, Position.Z + Size.ZDepth
        NewPosition3D(2) = Rotate(NewPosition3D(2), Rotation, RotatedPosition)
        
        
        'Vector4: low-right
        FillPosition3D NewPosition3D(3), Position.X + Size.Width, Position.Y, Position.Z
        NewPosition3D(3) = Rotate(NewPosition3D(3), Rotation, RotatedPosition)
    
    'Convert all 3D vectors to 2D vectors(for screen):
        Dim i As Integer
        For i = 0 To 3
            Points(i) = ConvertPositon3DTo2D(NewPosition3D(i), WorldSize)
        Next i
        
        'change the brush and pen:
        FillStyle = vbFSSolid
        'FillColor = vbRed
        
        
        DrawStyle = DrawStyleConstants.vbInvisible
    
    
        Polygon Me.hdc, Points(0), 4
        Dim TexturePoints(3) As POINTAPI
        TexturePoints(0) = Points(1) 'upper-left
        TexturePoints(1) = Points(2) 'upper-right
        TexturePoints(2) = Points(0) 'low-left
        If (PlgBlt(Me.hdc, TexturePoints(0), Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0) = 0) Then MsgBox CStr(GetLastError())
    the results:
    Name:  pgl.jpg
Views: 628
Size:  21.3 KB
    i belive that the problem is the low-right automatic calculation.
    but tell me what i'm doing wrong

  9. #24
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    VictorN: even not be C code... what you think about the image?
    heres a pseud-rectangle(A to D):
    B |-----------|C

    A |-----------| D
    "A pointer to an array of three points in logical space that identify three corners of the destination parallelogram. The upper-left corner of the source rectangle is mapped to the first point in this array, the upper-right corner to the second point in this array, and the lower-left corner to the third point. The lower-right corner of the source rectangle is mapped to the implicit fourth point in the parallelogram."
    - so the upper-left is B;
    - the upper-right is C;
    - the low-left is A;
    - the low-right is D... but these one is calculated automatic...
    the D is automatic, but seems wrong calculated(i move and the image go to C and it's correct, but not D)... why? what i did wrong?

  10. #25
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: how use PlgBlt() API function?

    \Could you post the real coordinates of these three points (TexturePoints(0), TexturePoints(1), TexturePoints(2)) you are passing into PlgBlt?
    Just use Debugger to obtain them.
    Victor Nijegorodov

  11. #26
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: how use PlgBlt() API function?

    Quote Originally Posted by VictorN View Post
    \Could you post the real coordinates of these three points (TexturePoints(0), TexturePoints(1), TexturePoints(2)) you are passing into PlgBlt?
    Just use Debugger to obtain them.
    debugger?

  12. #27
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    wow i found 1 problem: if the point have a negative value, i will get big numbers... ok these problem will be fixed. after i learn 1 math.
    heres the values:
    Name:  texturepoints.jpg
Views: 747
Size:  20.8 KB
    but what i did wrong with values?
    Last edited by Cambalinho; October 8th, 2020 at 03:15 PM.

  13. #28
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: how use PlgBlt() API function?

    Did you try to build your figures (both from TexturePoints array and from Points) on the paper?
    Victor Nijegorodov

  14. #29
    Join Date
    Apr 2009
    Posts
    1,355

    Re: how use PlgBlt() API function?

    no.... but i'm trying understand if the values from points() to texturepoints() are correct or not
    i'm confused... the texture go to the 1st to the 2nd points without problems... i belive the 3 point can be wrong, because don't use the low-right

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured