NO

Author Topic: Direct3D9 Tutorial 3: Matrices  (Read 8648 times)

mrtroy

  • Guest
Direct3D9 Tutorial 3: Matrices
« on: April 21, 2006, 06:53:25 PM »
I was a little bit bored this morning so I ported one of the DirectX examples over to C

Steps to get this to work:

1) Download the DirectX SDK (I'm using February 2006)
2) Go to C:\Windows\System32 (or equivalent) and polib some libraries

polib d3d9.dll /out:d3d9.lib
polib d3dx9_29 /out:d3dx9_29.lib

I'm not sure why there are so many versions of the d3dx9 libraries... oh well who cares as long as it works

3) move these lib files to a place that pelles c can find them ie the lib directory in the pellesc program directory

4) compile, run, and be merry

It really isn't that hard to port these over. If anyone is really interested I can do the rest (this one took five minutes)

ivanhv

  • Guest
Direct3D9 Tutorial 3: Matrices
« Reply #1 on: May 19, 2006, 04:42:18 PM »
Very nice, this libs for DX9, but...
   have you ported the headers?

It would be interesting with the DX9 .h files, not just the libs.

Ngan Lo

  • Guest
Direct3D9 Tutorial 3: Matrices
« Reply #2 on: May 20, 2006, 06:09:50 AM »
there is no need to "port" the headers, just include them & PellesC will compile.  8)

Offline WiiLF23

  • Member
  • *
  • Posts: 89
Re: Direct3D9 Tutorial 3: Matrices
« Reply #3 on: August 15, 2023, 04:02:06 AM »
I will clear this up. This is what I had to do for complete D3D9 support in Pelles C.

Download d3d9.h
https://github.com/apitrace/dxsdk/blob/master/Include/d3d9.h

Download d3d9caps.h
https://github.com/apitrace/dxsdk/blob/master/Include/d3d9caps.h

Download d3d9types.h
https://github.com/apitrace/dxsdk/blob/master/Include/d3d9types.h

Copy the header files to:
C:\Program Files\PellesC\Include

Download d3d9.lib (choose type)

32bit:
https://github.com/michaeljsmith/main/tree/master/third_party/DirectX/Lib/x86/d3d9.lib

64bit:
https://github.com/michaeljsmith/main/tree/master/third_party/DirectX/Lib/x64/d3d9.lib

Copy d3d9.lib to:
C:\Program Files\PellesC\Lib

Now head to Project Settings > Linker > add d3d9.lib

Add to source file
Code: [Select]
#pragma warn(disable: 1066)
#include d3d9.h

That's it.

-----

Verify:
Code: [Select]
void GetGPUInfo(HWND hWnd) {
    IDirect3D9* pD3D = Direct3DCreate9(D3D_SDK_VERSION);
   
    if (pD3D) {
        D3DADAPTER_IDENTIFIER9 adapterIdentifier;
        HRESULT hr = pD3D->lpVtbl->GetAdapterIdentifier(pD3D, D3DADAPTER_DEFAULT, 0, &adapterIdentifier);
       
        if (SUCCEEDED(hr)) {
            wchar_t modelName[128];
            MultiByteToWideChar(CP_ACP, 0, adapterIdentifier.Description, -1, modelName, 256);
           
            wchar_t infoMessage[1024];
            wsprintfW(infoMessage, L"GPU Model: %s\n"
                                    L"Vendor ID: 0x%04X\n"
                                    L"Device ID: 0x%04X\n"
                                    L"Driver Version: %d.%d.%d.%d",
                      modelName,
                      adapterIdentifier.VendorId,
                      adapterIdentifier.DeviceId,
                      HIWORD(adapterIdentifier.DriverVersion.HighPart),
                      LOWORD(adapterIdentifier.DriverVersion.HighPart),
                      HIWORD(adapterIdentifier.DriverVersion.LowPart),
                      LOWORD(adapterIdentifier.DriverVersion.LowPart));
           
            MessageBox(hWnd, infoMessage, L"GPU Information", MB_OK);
        }
       
        pD3D->lpVtbl->Release(pD3D);
    }
}

Usage:
Code: [Select]
static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        GetGPUInfo(hwndDlg);
        return TRUE;

        // other cases
    }
   
    return FALSE;
}
« Last Edit: August 15, 2023, 04:35:16 AM by WiiLF23 »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Direct3D9 Tutorial 3: Matrices
« Reply #4 on: August 15, 2023, 10:38:27 AM »
 :)
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline WiiLF23

  • Member
  • *
  • Posts: 89
Re: Direct3D9 Tutorial 3: Matrices
« Reply #5 on: August 16, 2023, 02:51:57 AM »
Thank you very much! This has greatly assisted in converting AMD Display Driver DLL to a static library, while NVIDIA already includes this static library in their own SDK.

Much appreciated!

atiadlxx.lib
« Last Edit: August 16, 2023, 02:55:26 AM by WiiLF23 »