08/04/11 00:50:24
DrawIndexedPrimitiveUPで四角いテクスチャ3つ表示したいのですが、
何も表示できません。教えてください。
struct CUSTOMVERTEX{
float x,y,z; float rhw; DWORD c; float u,v;
};
IDirect3DIndexBuffer9* pIndex;
g_pD3DDev->CreateIndexBuffer(sizeof (USHORT) * 18,
D3DUSAGE_WRITEONLY , D3DFMT_INDEX16 , D3DPOOL_MANAGED , &pIndex,NULL);
USHORT index[18] = {
0,1,2,3,2,1,// 1枚目
4,5,6,7,6,5,// 2枚目
8,9,10,11,10,9// 3枚目
};
void *bBuf;
pIndex->Lock(0 , sizeof(USHORT)*12 , (void**)&bBuf , 0);
memcpy(bBuf , index , sizeof (USHORT) * 18);
pIndex->Unlock();
CUSTOMVERTEX v[12]=
{
{ x + width/2, y - height/2, 0.0f, 1.0f,0xffffffff, 1.0f, 0.0f},
{ x + width/2, y + height/2, 0.0f, 1.0f,0xffffffff, 1.0f, 1.0f},
{ x - width/2, y - height/2, 0.0f, 1.0f,0xffffffff, 0.0f, 0.0f},
{ x - width/2, y + height/2, 0.0f, 1.0f,0xffffffff, 0.0f, 1.0f},
...(あと8つほど略)
};
g_pD3DDev->SetTexture(0, pTexture);
g_pD3DDev->SetIndices(pIndex);
g_pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
g_pD3DDev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST ,0,
12,6 , pIndex ,D3DFMT_INDEX16, v , sizeof(CUSTOMVERTEX));