   Getting D3DXSprite to fit the screen...
  I'm trying to render a sprite using D3DXSprite and stretch it across the whole screen.  However, it always seems to big even when the size is 640x480 and the screen dimentions are 640x480.Here is my code for rendering:  g_engine->GetSprite()->Begin( D3DXSPRITE_ALPHABLEND );D3DXMATRIX iden;D3DXMatrixIdentity( &iden );g_engine->GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);g_engine->GetDevice()->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);g_engine->GetDevice()->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA );g_engine->GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1);g_engine->GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);g_engine->GetSprite()->SetTransform( &iden );g_engine->GetSprite()->Draw( m_scope->GetTexture(), NULL, NULL, NULL, 0xFFFFFFFF );g_engine->GetSprite()->End();I tried setting an ortho perspective with the screen dimentions inside the begin/end calls, but it had no effect so I'm assuming that D3DXSprite does that for you?   
  This could just be a guess, but this could be the result you're giving it a completely blank transformation matrix. I'd consider looking at D3DXMatrixTransformation2D and building a real matrix exactly the way you want it.   ;  Well I fiddled around with it for a while and it finally works. g_engine->GetSprite()->Begin( D3DXSPRITE_ALPHABLEND );g_engine->GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);g_engine->GetDevice()->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);g_engine->GetDevice()->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA );g_engine->GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1);g_engine->GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);D3DXMATRIX transform;D3DXMATRIX back;D3DXVECTOR3 scale( (float)g_engine->GetDisplayMode()->Width / (float)m_scope->GetWidth(), (float)g_engine->GetDisplayMode()->Height / (float)m_scope->GetHeight(), 1.0f );D3DXVECTOR3 center( (float)m_scope->GetWidth() / 2.0f, (float)m_scope->GetHeight() / 2.0f, 0.0f );D3DXVECTOR3 move( (float)g_engine->GetDisplayMode()->Width /2.0f, (float)g_engine->GetDisplayMode()->Height/2.0f , 0.0f);D3DXMatrixTransformation( &transform, NULL, NULL, &scale, &center, NULL, &move ); g_engine->GetSprite()->GetTransform( &back );g_engine->GetSprite()->SetTransform( &transform );g_engine->GetSprite()->Draw( m_scope->GetTexture(), NULL, &center, NULL, 0xFFFFFFFF );g_engine->GetSprite()->SetTransform( &back );g_engine->GetSprite()->End();Took me a while to get the right combination of passing in different parameters to the matrix transform function and sprite draw function, but it finally works.Thanks, flimflam.[Edited by - Muhammad Haggag on December 10, 2005 3:37:23 PM]