Advertisement

Antialiasing in Direct3D9

Started by June 02, 2022 07:36 AM
0 comments, last by ESries19 2 years, 5 months ago

Hello everyone, I'm trying to enable full-scene antialiasing in my d3d9 game.

I'm basically just following Microsoft instructions to the T. However the device is always failing.

Here's how I'm doing it in accordance with Microsoft instructions:

// Check if device supports multisampling

if (SUCCEEDED(ms_lpd3d->CheckDeviceMultiSampleType(ms_iD3DAdapterInfo, D3DDEVTYPE_HAL, D3DFMT_R8G8B8, FALSE, D3DMULTISAMPLE_2_SAMPLES, NULL)))

// parameters structure

D3DPRESENT_PARAMETERS ms_d3dPresentParameter{};
ZeroMemory(&ms_d3dPresentParameter, sizeof(ms_d3dPresentParameter));
ms_d3dPresentParameter.BackBufferFormat = D3DFMT_R8G8B8;
ms_d3dPresentParameter.Windowed = FALSE;
ms_d3dPresentParameter.SwapEffect = D3DSWAPEFFECT_DISCARD;
ms_d3dPresentParameter.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;

// Creating the device

ret = ms_lpd3d->CreateDevice(ms_iD3DAdapterInfo, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &ms_d3dPresentParameter, &ms_lpd3dDevice);

// Checking if it fails

if (FAILED(ret))
{ 
return CREATE_GET_DEVICE_CAPS2;
}

// Finally, enabling the antialiasing

ms_lpd3dDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);

Any idea why it's failing? I've been at it for 4 days now. I would appreciate any help.

This topic is closed to new replies.

Advertisement