I'm using Direct3D to draw vertices from a vertex buffer with vertex format FVF_XYZ
.
I want to implement the functionality to draw lines now. When drawing a line in 3D space I project the end points to 2D screen space and use my function to draw a line from 2D space. My problem is with this function.
My vertex buffer contains two vertices with coordinates (0,0,0)
and (1,0,0)
. I am planing to transform this basic line to my final line with basic math and transformations.
The problem is that when I want to render a vertex to screen coordinate (0,0)
for example I don't know how to set up the transformation matrices.
From my understanding I should end up and screen coord (0,0)
when setting world, view and projection matrix to identity, but (0,0,0)
then ends up at the center of the screen.
How would I need to set up world, view and projection matrices so that I transform from (0,0,0)
to (0,0)
and from (1,0,0)
to (1,0)
and so on?