D3DXMATRIX n = viewmatrix * projectionmatrix;
D3DXMATRIX textposition3d;
D3DXMatrixIdentity(&textposition3d);
D3DXMatrixTranslation(&textposition3d, 6.0f, 0.0f, 0.0f);
D3DXMATRIX textposition2d = textposition3d * n;
r->rendertext(L"text on screen", <x coordinate>, <y coordinate>);
I'm not sure whether this is the correct way to go about it and I also have no idea how to extract the coordinates from the textposition2d matrix.
Any help would be appreciated :)
Projecting 3D coordinates to 2D for text drawing
I'm trying to draw text on screen using ID3DXFont but this only takes 2D coordinates. So far I've got:
You can use the handy D3DXVec3Project() function to project a vector from object space to screen space.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement