Jump to content
  • Advertisement
Sign in to follow this  

convert coordinates

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a point defined on screen, that i captured using Win32 API "GetCursorPos" and transformed it with the "ScreenToClient" in order to know where the click was made on screen. After that i created a PointF variable to keep the values of .X and .Y. I need to use that point (actually its a lot of points created that way) in a variable of type Direct3D.CustomVertex.PositionColored, in order to position the point in my 3d world. Of course that if i do something like: tmp_point = (PointF)m_pontos_coordenadas[key]; // tmp_point is a PointF variable v = new Vector3(tmp_point.X, -tmp_point.Y, 1.0f); vertexColored[internal_counter].SetPosition(v); //vertexColored[internal_counter]is a variable of type Direct3D.CustomVertex.PositionColored this wont work because one is in screen coordinates and the other is in world coordinates. How can i convert the screen coordinates to the world coordinates? my World is defined as: graphics.Transform.View = Matrix.OrthoOffCenterLH(0, screenwidth - 150, screenheight, 0, 1, 10); where screenwidth =800 and screenheight=600 Can you help? my thanks in advanced

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!