Hi, I am trying to program a kind of a Minimap using a camera placed on the top of my scene, this camera renders its view onto a texture that I later, in the minimap render function, place on a quad. This quad will be rendered on the screen on top of the scene… I think you know what I mean.
Anyways, I thought I´d use a Orthogonal projection matrix to render the minimap quad on top of my scene, but it did not work properly.
First I have problems putting the quad on the screen and if I move the main camera, the quad stay on its original place on the world and not on its place on the screen, I mean, it turns around with the rest of the geometry... Is that explanation clear???
The code:
The orthogonal matrix:
D3DXMatrixOrthoLH ( &m_mtOrthogonal,
( float )xDesc.Width, ( float)xDesc.Height,
0.5f, 1000.0f );
And this is the render function:
void cMinimap::Render( void )
{
UINT uiPasses;
m_pEfx->SetTexture( "Texture0", m_pMinimap );
m_pEfx->SetTechnique( "Minimap" );
m_pDevice->SetVertexDeclaration( m_pDeclaration );
m_pDevice->SetStreamSource( 0, m_pMiniVB, 0, sizeof( MyVertices ) );
m_pEfx->SetMatrix( "g_mWorld", &m_mtIdentity );
m_pEfx->SetMatrix( "g_mProjection", &m_mtOrthogonal );
m_pEfx->Begin( &uiPasses, 0 );
for( UINT i = 0; i < uiPasses; i++ )
{
m_pEfx->BeginPass( i );
m_pDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
m_pEfx->EndPass();
}
m_pEfx->End();
}
Can anybody help me???
TIA
Poncho
[Edited by - Poncho on May 6, 2007 8:39:09 AM]