Rotating TransformedTextured Vertices around a specific point? (MDX, C#)

Hello everyone!

What I am trying to do, is to draw a textured 2d square using on-screen coordinates (therefore using TransformedTextured, and not PositionTextured), using vertices, and rotating the square around a specific point in the z axis, however after a good hour of googling, I can only seem to find examples of doing this with PositionTextured vertices, I am beginning to wonder if I am actually looking in the wrong direction. Is there any way I can convert on-screen coordinates to world matrix coordinates I would appreciate any help, hints or examples on how this could be done.
Thanks in advance!

//Avi



Answer this question

Rotating TransformedTextured Vertices around a specific point? (MDX, C#)

  • Everett

    What do you mean by 'around a specific point in the z axis' If you are in 2d using screen coordinates you would probably want to rotate around an (x,y) position.

    If you mean rotate around the z axis (i.e. around x=0, y=0) then you have to move the vertices yourself. When you use Transformed vertices you are telling the graphics hardware that YOU have done all the transformations yourself so none of the transformation render states will have any effect. So loop through your vertex buffer and multiply by the transformation matrix.



  • Max Norris

    Yes, I'm sorry, I mean around an (x,y) position. Should I still use the same method with looping through the vertex buffer and applying my transformation matrix that way


  • syperk

    I see. But as far as I can see, there's still a problem. I wan't to be able to position my objects with exact screen coordinates, is there any way I can translate my screen coordinates to 3d coordinates

  • kavallo

    Yes, you told the graphics card that the vertices you send are already transformed so its your job to do any transformations.

    Otherwise use 3d coordinates with a constant z and put your camera somewhere looking at the x/y plane.Then you can use the world transforms to do the rotation.



  • Rotating TransformedTextured Vertices around a specific point? (MDX, C#)