I would like to get 2D screen coordinates of a 3D coordinates point with OGRE.
Is there any simple ogre function to do this ?
Thanks a lot.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think there isn’t an OGRE function to do that directly, but you can obtain the same result with a minimal effort.
You have a 3D point, in world space, and you want to project your point into screen space. So, you need to multiply the point for the projection matrix and the view matrix, then you need to map the resulting point from coordinate space [-1 1] to [0 1].
For example:
Of course, if you want the coordinates relative to the screen size, you have to multiply the point for the width and height of the viewport.