|
|
我想?1?l?色的?,可是?s?示不出?
以下是我的source code
typedef struct {
FLOAT x, y, z; // 2-D coordinates
FLOAT rhw; // rhw
DWORD color; // The vertex color
} sVertexSelect;
#define VERTEXFVF_SELECT (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
IDirect3DVertexBuffer9 *m_pVB_SelectRect;
void CAppDraw: rawSelectLine()
{
BYTE *Ptr;
COLORREF crRed=RGB(255,0,0);
sVertexSelect Verts_Select[2]=
{
{1.0f,1.0f,1.0f,1.0f,crRed},
{1.0f,100.0f,1.0f,1.0f,crRed},
};
m_pVB_SelectRect->Lock(0,0, (void**)& tr, 0);
memcpy(Ptr, Verts_Select, sizeof(Verts_Select));
m_pVB_SelectRect->Unlock();
m_pD3DDevice->SetTexture(0, NULL);
m_pD3DDevice->SetStreamSource( 0, m_pVB_SelectRect,0, sizeof(sVertexSelect) );
m_pD3DDevice->SetFVF( VERTEXFVF_SELECT );
m_pD3DDevice->DrawPrimitive( D3DPT_LINELIST, 0, 1 );
}
BOOL CAppDraw::DoFrame()
{
// Clear device backbuffer
m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0,64,128,255), 1.0f, 0);
// Begin scene
if(SUCCEEDED(m_pD3DDevice->BeginScene()))
{
DrawSelectLine();
// End the scene
m_pD3DDevice->EndScene();
}
// Display the scene
m_pD3DDevice->Present(NULL, NULL, NULL, NULL);
return TRUE;
} |
|