DirectX and Delphi - Matrices

Started by
-1 comments, last by Builder 18 years, 7 months ago
Hi all. I am a newbe in DirectX Programming and i am trying to write a litle engine with Delphi. I trying to implement a Camera Class, but it don't work! Here is a bit of a source:

procedure TD3DCamera.UpdateCamera(FLAG : Byte = CAM_COMPLETE);
begin
  if not pUpdating then
  begin
    if (FLAG and CAM_VIEW)<>0 then D3DXMatrixLookAtLH( pmatView, pEyePoint, pLookatPt, pUpVec );
    if (FLAG and CAM_PROJECTION)<>0 then D3DXMatrixPerspectiveFovLH( pmatProj, pfov, pAspect, pMinDistance, pMaxDistance );
    if (FLAG and CAM_WORLD)<>0 then D3DXMatrixRotationY( pmatWorld, Windows.GetTickCount/550.0 );
  end;
end;

...

procedure TD3DCamera.UseCamera;
begin
  D3DApplication.D3DDevice.SetTransform( D3DTS_WORLD, pmatWorld );
  D3DApplication.D3DDevice.SetTransform( D3DTS_VIEW, pmatView );
  D3DApplication.D3DDevice.SetTransform( D3DTS_PROJECTION, pmatProj );
end;

...

function TD3DApp.Render: HResult;
var
  i : Integer;
begin
  //Clear device
  pD3DDevice.Clear( 0, nil, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0, 0 );
  //Begin scene
  pD3DDevice.BeginScene;
  //Render scene
  Camera.UpdateCamera;
  Camera.UseCamera;
  //Render objects
  for i:=0 to Pred(ObjectCount) do Objects.Render;

  //End scene
  pD3DDevice.EndScene;

  //Present the result
  pD3DDevice.Present( nil, nil, NULL, nil );

  result:=S_OK;
end;
I have thinking the Object (it is a single Triangle) must be rotating, but he dosn' do this!!!!! Please help me! I am using Delphi 2005 and DirectX9 Units from JEDI-Project Thanks Sory for my bad Englisch!

This topic is closed to new replies.

Advertisement