Hello
I have a project with box2d and directx where i would like to have the ability to create a polygon with vertices that are based on points that the mouse inputs and map them to the vert buffer. When clicked the mouse will give an x and y value from 0 to HEIGHT(800) and 0 to WIDTH(600).I managed to convert those points to object-space(-1.0 to 1.0):
float X = float((-1.0f)*((2.0f/float(SCREEN_WIDTH))*float(mouse.GetMouseX())-1.0f));
float Y = float((-1.0f)*((2.0f/float(SCREEN_HEIGHT))*float(mouse.GetMouseY())-1.0f));
but the problem arises when i add the World, View and Projection matrix i end up with inaccurate vertices( not where the mouse clicked). Basically i'm clicking in object-space when i should be clicking in projection-space.
So my question is is there a way to scale (convert) these vertices given by the mouse so that when they are in
projection-space they match the position of the mouse.
Any articles or tutorials on this or transformations would be great.
Thanks