|
|
发表于 2008-4-17 07:50:00
|
显示全部楼层
Re:怎样在d3d中画点和线?
初步确定是id3dxline,应该可以改变宽度的,有setwidth的接口。
// In the header.
ID3DXLine *line;
// In the cpp.
OnCreateDevice()
{
D3DXCreateLine( d3dDevice, &line );
line->SetWidth( 10 );
line->SetPattern( 0xffffffff );
}
OnRestoreDevice()
{
line->OnResetDevice();
}
OnRender()
{
if( line )
{
D3DXVECTOR2 points[2];
points[0] = D3DXVECTOR2( 0.0f, 50.0f );
points[1] = D3DXVECTOR2( 400.0f, 50.0f );
line->Draw( points, 2, 0xffffffff );
}
}
OnDeviceLost()
{
line->OnLostDevice();
}
OnDeleteDevice()
{
line->Release();
}
line->OnResetDevice();
}
OnRender()
{
if( line )
{
D3DXVECTOR2 points[2];
points[0] = D3DXVECTOR2( 0.0f, 50.0f );
points[1] = D3DXVECTOR2( 400.0f, 50.0f );
line->Draw( points, 2, 0xffffffff );
}
}
OnDeviceLost()
{
line->OnLostDevice();
}
OnDeleteDevice()
{
line->Release();
}
|
|