CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Texas, USA
    Posts
    1,206

    Transforming 2D Shapes

    Currently, I have a 3D scene (game) that has interface elements. One interface element in particular is a 2D triangle. This triangle should be measured in screen units (pixels). Currently, my FVF uses D3DFVF_XYZRHW. This means that I cannot apply transformations to any of my 2D shapes because D3DFVF_XYZRHW is a transformed vertex. My triangle object is created using a vertex buffer.

    I set my transformations via a call to IDirect3DDevice9::SetTransform(). I was wondering if someone could show me how to create 2D shapes measured in pixels that are able to have transformations.

    Currently, I am a bit clueless as to how this would be done. If someone could provide detailed explanations with code samples, it would help me a lot. Thank you!
    --MrDoomMaster
    --C++ Game Programmer


    Don't forget to rate me if I was helpful!

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Transforming 2D Shapes

    D3DFVF_XYZRHW are "Transformed" vertices, so you cannot "transform" them further.
    Either you'll have to it yourself which requires locking the vertex buffer etc.
    OR switch to untransformed vertices (D3DFVF_XYZ) and use an orthogonal view matrix. Also take a look at D3DXMatrixOrthoOffCenter and http://www.gamedev.net/community/for...opic_id=119782 .
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

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