Advertisement Jump to content
Sign in to follow this  
Builder

DirectX and Delphi - Matrices

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!