Original Post
[I use DirectX 7!]
I'm trying to setup a orthogonal projection matrix, so I can render faces as if they were 2D. The problem that I have is that nothing shows up on my screen. I do the following:
Once at startup:
Thanks in advance!
Marc
[edited by - Marc aka Foddex on April 23, 2004 5:01:36 AM]
// create orthogonal projection matrix for this window D3DXMatrixOrtho(&m_orthogonal_projection_matrix, (float)m_videowindow_width, (float)m_videowindow_height, -1, 1); D3DXMatrixIdentity(&m_orthogonal_world_matrix);When I want to render '2D faces', I setup the world and projection matrix once like this:
m_d3ddevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX *)&m_orthogonal_projection_matrix); m_d3ddevice->SetTransform(D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *)&m_orthogonal_world_matrix);Then the function that renders a 2D quad looks like this:
void RendererEngine_Direct3D::Draw2DTexturedRectangle(int x1, int y1, int x2, int y2)
{
float x1f = (float)x1, y1f = (float)y1, x2f = (float)x2, y2f = (float)y2;
float vertices[5*4] =
{
/*pos*/x1f, y1f, 0, /*texcoord*/ 0, 0,
/*pos*/x2f, y1f, 0, /*texcoord*/ 1, 0,
/*pos*/x2f, y2f, 0, /*texcoord*/ 1, 1,
/*pos*/x1f, y2f, 0, /*texcoord*/ 0, 1,
};
m_d3ddevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZ | D3DFVF_TEX1, vertices, 4, 0);
}
Can anyone point out to me the mistake I must be making?