[D3D][C++] No fog tutorial
- Download and install MS Visual C++
- Download and install MS DirectX 9 sdk
- Link the DirectX 9 sdk include, Library and src directories into MS Visual C++ (Tools->Options->Directories)
- Download the Direct3D StarterKit by Azorbix.
- Extract the D3D9 folder from the starterkit to anywhere on your pc.
- Create a new Win32 Dynamic-Link library project in MS Visual C++ (File->New->Projects)
- Enter a project name, Location name and click ok, Then check the "An empty DLL project" checkbox and click ok
- In MS Visual C++ find your workspace folders called Source files, Headers files and Resource files. (Usually in a column on the left)
- Right click on the Source files folder and click "Add files to folder"
- Open the D3D9 folder you extracted from the starterkit in the window that pops up and highlight all the .cpp files and then click ok.
- Do the same with Header files folder but this time add all the .h files instead.
- Double click on the "d3d9dev.cpp" file in your Source files folder in MS Visual C++
- Find the DrawIndexedPrimitive function below in d3d9dev.cpp
HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMIT IVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
return m_pD3Ddev->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
14. Add "m_pD3Ddev->SetRenderState(D3DRS_FOGENABLE, false);" into that function like below
HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMIT IVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
m_pD3Ddev->SetRenderState(D3DRS_FOGENABLE, false);
return m_pD3Ddev->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
15. Compile your project (Build->Batch build) Check both checkboxs (Rebuild all)
16. Open your project folder that will be saved in your location name you entered when creating a new project
17. Find the Release folder and copy your .dll to your desktop
18. Get a injector and inject your .dll into your game.
19. Go play with no fog
© Roverturbo
If you did everything right and didn't miss any steps of this tutorial.
You'll get the same .dll as i did.
Please register or login to download attachments.