Click to See Complete Forum and Search --> : Transforming 2D Shapes


MrDoomMaster
October 29th, 2005, 02:30 PM
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!

Marc G
October 30th, 2005, 02:51 AM
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/forums/topic.asp?topic_id=119782 .