I am trying to (using a 2D Directx9 engine library) rotate/translate a set of points in a vertex buffer.

I understand how this would be done in a 3D system - i.e using the vertex shader stage of the rendering pipeline with transformation matricies...

But Im not sure that applies in 2D? (or am I wrong). I don't know where any of the vertex shader stage happens in 2D? or whether it happens at all.

Basically I can create a transformation matrix using some thing like D3DXMatrixTransformation2D() and I know how to apply that to an LPD3DXSPRITE object (using Sprite->SetTransform()), but how can I apply that transformation matrix to a set of 10+ coordinates stored in a vertex Buffer instead of a sprite.

Any help or suggestions would be greatly appreciated. Thanks

  • \$\begingroup\$ This needs to be done in the shader. The vertex buffer shouldn't be altered. \$\endgroup\$ Oct 16 '14 at 2:40
  • \$\begingroup\$ Could you elaborate on how this would be done? As I said in my question, I don't know how to access the vertex shader. \$\endgroup\$
    – unknownSPY
    Oct 16 '14 at 7:14
  • \$\begingroup\$ Assuming the 2D engine you are using is written using Direct3D 9, vertex processing is the same for 3D and 2D systems. You would just set that D3DXMatrixTransformation2D matrix as the world matrix in your vertex shader. \$\endgroup\$ Oct 20 '14 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.