Hi,
I am trying to display a DirectX 9 Sprite but I cant seem to get it to display on the screen?
All I get is a black screen and no sprite is drawn?
Code is below, any help would be appreciated - thanks!
JeZ+Lee
//-------------------------------------------------------------------------------------------------------------------------------
void loadTexture( void )
{
D3DXCreateTextureFromFileEx(DXDevice, L"TC5-Logo.png", D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0,
D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &SpriteTexture);
}
//-------------------------------------------------------------------------------------------------------------------------------
void render( void )
{
DXDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), 1.0f, 0 );
D3DSURFACE_DESC textureInfo;
SpriteTexture->GetLevelDesc(0, &textureInfo);
RECT spriteRect;
spriteRect.top = 0;
spriteRect.left = 0;
spriteRect.bottom = textureInfo.Height;
spriteRect.right = textureInfo.Width;
Sprite->Begin(D3DXSPRITE_ALPHABLEND);
D3DXVECTOR3 spritePosition;
spritePosition.x = 0.0f;
spritePosition.y = 0.0f;
spritePosition.z = 0.0f;
Sprite->Draw(SpriteTexture, &spriteRect, NULL, &spritePosition, NULL);
Sprite->End();
DXDevice->Present( NULL, NULL, NULL, NULL );
}
//-------------------------------------------------------------------------------------------------------------------------------