Original Post
I have a triangle shown on the screen, then I call my render function and call the matrix function right after BeginScene(); but it does nothing but show the triangle. with no change to anythinng. The function seems to do nothing. I have tryed diffrent things over and over trying to see what is wrong and even compare my code to MS''s tutorials and can''t find out what is wrong. I will show my render and matrix functions and if anyone and see whats wrong please post.
My matrix Function
source
void DSApp_3D::DoMatrixs() {
HRESULT hr;
D3DXMatrixRotationY( &WorldMatrix, timeGetTime()/150.0f );
hr = pD3DDevice->SetTransform(D3DTS_WORLD, &WorldMatrix);
if(hr != D3D_OK) {
DXTrace(__FILE__, __LINE__, hr, "Error Seting world Transformation", TRUE);
}
D3DXMatrixLookAtLH(&ViewMatrix, &D3DXVECTOR3( 0.0f, 3.0f,-115.0f ),
&D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
hr = pD3DDevice->SetTransform(D3DTS_VIEW, &ViewMatrix);
if(hr != D3D_OK) {
DXTrace(__FILE__, __LINE__, hr, "Error Seting view Transformation", TRUE);
}
D3DXMatrixPerspectiveFovLH(&ProjectionMatrix, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
hr = pD3DDevice->SetTransform(D3DTS_PROJECTION, &ProjectionMatrix);
if(hr != D3D_OK) {
DXTrace(__FILE__, __LINE__, hr, "Error Seting projection Transformation", TRUE);
}
}
/source
My Render Function
source
void DSApp_3D::Render(void) {
pD3DDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
pD3DDevice->BeginScene();
this->DoMatrixs();
pD3DDevice->SetStreamSource(0, D3DVertexBuff, sizeof(DS3D_Point));
pD3DDevice->SetVertexShader(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
pD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
pD3DDevice->EndScene();
pD3DDevice->Present( NULL, NULL, NULL, NULL );
}
/source