Original Post
Could some one please tell me what I'm doing wrong? The SetTransform funtions don't work. I do see my two triangles, but I also want them to rotate. I searched the internet, the documentation and two books, but I can't find a solution. With kind regards, MarauderX
void DoSomething(void)
{
CUSTOMVERTEX vertices[] =
{
{ 150.0f, 50.0f, 0.5f, 1.0f, 0xffff0000, }, // RED x, y, z, rhw, color
{ 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, }, // GREEN
{ 50.0f, 250.0f, 0.5f, 1.0f, 0xff00ffff, }, // CYAN
{ 150.0f, 450.0f, 0.5f, 1.0f, 0xffffffff, }, // WHITE
};
// for this post: I'm putting stuff in a buffer here (no problems)
while(true)
{
if (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
// do something
}
else
{
D3DXVECTOR3 vEyePt ( 0.0f, 3.0f,-5.0f );
D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec ( 0.0f, 1.0f, 0.0f );
D3DXMATRIXA16 matView;
D3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec );
pDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
pDevice->SetTransform( D3DTS_PROJECTION, &matProj );
pDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,255),1.0f,0);
pDevice->BeginScene();
D3DXMATRIX matWorld;
D3DXMatrixRotationY( &matWorld, timeGetTime()/150.0f );
pDevice->SetTransform( D3DTS_WORLD, &matWorld );
pDevice->SetStreamSource( 0, vBuffer, 0, sizeof(CUSTOMVERTEX) );
pDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
pDevice->SetIndices(iBuffer);
pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, 4, 0, 2);
pDevice->EndScene();
pDevice->Present(0, 0, 0, 0);
}
}
}