Clootie graphics pages - Articles

 How to compile ObjectPascal DirectX examples
  
Contents
  • Introduction
  • What additional files do you need (Delphi and C++Builder)?
  • Compilation options (Delphi and C++Builder)
  • Delphi special actions
  • C++ Builder special actions
  • Finally: I've compiled but they are not running properly!!!?

  • Introduction

    This page describes which additional files you will need and actions you should take to compile MS DirectX 8.x / DirectX 9.x SDK's samples translated to Object Pascal and other Direct3D samples from this site. You can compile them all either in Delphi 4-6 or C++Builder 5-6.


    What additional files do you need (Delphi and C++Builder)?

    1. DirectX headers from this site ("Borland and JEDI compliant")
      [ Clootie_DirectXxx.zip: DirectX 8.0b version / DirectX 8.1 version / DirectX 9.0 version ]
    2. Converted D3DFramework used by all Direct3D SDK samples and most other Direct3D examples on this site
      [ D3DFrame.zip for DirectX 8.0b / for DirectX 8.1 or Common.zip for DirectX 9.x ]
    3. Helper DLL libraries (D3DX, DXErr):
      [ Clootie_DX[xx]_dlls.zip : DirectX 8.0b version / DirectX 8.1 version / DirectX 9.0 version ]
      I recommend you to place these DLL's in Windows system directory.


    Compilation options (Delphi and C++Builder)

    You can compile DirectX 8.x examples with either Direct3D8.pas from above referenced DirectX headers ("Borland and JEDI compliant") or with DirectXGrapics.pas (from Tim Baumgarten). By default exaples compile with Direct3D8.pas, to change this behaviour you should define "DXG_COMPAT" symbol (in project options).
    DriectX 9.x examples has been tested and supported only against above referenced headers ("Borland and JEDI compliant").

    Note: Althrow you can compile DirectX 8.x examples with DirectXGraphics.pas from Tim Baumgarten site, but you can't use "completely revised" D3DX8.pas from the same package due to introduced incompatibilities. So the only options is D3DX8.pas from "Borland and JEDI compliant" Direct3D headers. With DirectX 8.1 headers you can simultaneuosly use Tim Baumgarten D3DX81mo.pas headers for D3DX8 and this will not increase your redistributive size as they are both using the same D3DX8 helper dll library internally.


    Delphi special actions

    Setup library paths
    To successfully compile examples you need to add additional paths to your "Library path" directories, in order shown below (from top to bottom):
    1. "Borland and JEDI compliant" DirectX headers
    2. Converted D3D Framework from DirectX (8.x or 9.x) SDK
    3. Optionally - DirectX 8 headers from Tim Baumgarten site. You need to download these headers add directory only if you want to compile with DirectXGraphics.pas (look above).

    Setup paths and where to place samples (for DirectX 9.0 SDK samples)
    Starting from DirectX9 most of the samples require access to DirectX.ico icon file to compile files with resource description (.RC). This file is provided with common DirectX framework. So, for seamless compilation it's recommended to place downloaded files in directory structure like shown below:
    • Delphi_DirectX_SDK - can be any other name
      • Common - converted Common DirectX Framework - Common.zip
      • Direct3D - translated Object Pascal Direct3D examles
        • Pick - first sample
        • VCLFog - another sample
        • ...
      • DirectSound - translated Object Pascal DirectSound examles
        • SoundFX - first sample
        • ...


    C++ Builder special actions

    Setup paths and where to place samples
    C++Builder doesn't allow to specify common paths (for use with all projects), but these paths are stored locally with each project. So, all project files for examples contain relative paths to files, used by projects. Examples uses: include files from MS DirectX SDK, DirectX object pascal headers, D3D Framework from DirectX 8.x/9.x SDK converted to pascal, special lib's for Borland C++ compiler.
    These files should be placed inside root directory of installed Microsoft DirectX 8.x/9.x SDK, like shown below:
    • DxSdk root directory
      • Include - original MS include files
      • SamplesDelphi - can be any other name
        • Common - converted D3D Framework - D3DFrame.zip / Common.zip
        • Direct3D - translated Object Pascal examles
          • Pick - first sample
          • VCLFog - another sample
        • Headers - Object Pascal headers for DirectX 8.x or 9.x
        • Lib - LIB files from this site for Borland C++ compiler
    You can download small ZIP archive with directory structure described above: C++Builder_Dirs.


    Finally: I've compiled but they are not running properly!!!?

    If you meet this problem there are two possible reasons:

    1. Samples refuse to run due to absent D3DX helper DLL library - either d3dx8ab.dll, d3dx81ab.dll or d3dx9ab.dll. These DLL's are provided with separate archives and link to them provided at top of this article. I recommend to place them in one of the Windows system directories.
    2. Sample can refuse to run because of media files (supplied by MS DirectX 8.x or DirectX 9.x SDK) are missing - I mean bitmaps, meshes (X-files) etc. Currently I highly recommend you to download DirectX SDK from Microsoft site as althrow it's designed for VC++ and VB but contains a lot of other usefull tools, info and debug runtime!
      But... If you want to see quick result: try too look at tutorials series in SDK samples as they are come with all needed media files, also most of the custom samples come with media and EXE files too.
      And as another option: on download pages for Delphi DirectX SDK headers (links can be found at top of this article) - right below header's and DLL's - you can find section "DirectX SDK Media files" with links to ZIP archives containing most of the wanted resources from Media directory of DirectX SDK.



    Please inform me of any grammar or general errors, contained on these pages, Alexey Barkovoy
    Last updated: 11-Sep-2003

    Hosted by uCoz