Sign in to follow this  
Builder

DirectX and Delphi - Matrices

Recommended Posts

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[i].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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this