|
|
本人在3D空间设置了一个广告牌,广告牌显示正常,接着想在广告牌上输出文字,使用了下面的办法,但是文字并没有显示出来,请教高手指点,谢谢。
DrawTextOnPanel(TCHAR* Text,int PosX,int PosY, D3DCOLOR Color,DWORD Format)
{
if(m_pPanel!=NULL && m_pPanelTexture!=NULL)
{
//取得文字面板宽高
long Width,Height ;
GetPicWidth(Width);
GetPicHeight(Height);
//文字面板区域
RECT rect;
rect.left=PosX;
rect.top=PosY;
rect.right=rect.left + Width;
rect.bottom=rect.top + Height;
//渲染面板和文字
m_pPanel->Begin(D3DXSPRITE_BILLBOARD|D3DXSPRITE_ALPHABLEND);
m_pPanel->Draw(m_pPanelTexture,&rect,new D3DXVECTOR3(32.0f,0.0f,0.0f), NULL, 0xffffffff);
m_pPanel->Flush(); //确信已送出面板数据
m_pFont->DrawText(m_pPanel,Text, strlen(Text), &rect, Format, Color);
m_pPanel->End();
}
} |
|