thanks for your response! the code where i create the device:
ZeroMemory(&PresentParams, sizeof(D3DPRESENT_PARAMETERS));
PresentParams.BackBufferWidth = Config->Direct3D.Videomode.Width;
PresentParams.BackBufferHeight = Config->Direct3D.Videomode.Height;
PresentParams.BackBufferFormat = Config->Direct3D.BackbufferFormat;
PresentParams.BackBufferCount = 1;
PresentParams.MultiSampleType = Config->Direct3D.MultiSampleType;
PresentParams.MultiSampleQuality = Config->Direct3D.MultiSampleQuality-1;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow = Window;
PresentParams.Windowed = Config->Direct3D.Windowed;
PresentParams.EnableAutoDepthStencil = TRUE;
PresentParams.AutoDepthStencilFormat = Config->Direct3D.ZStencilbufferFormat;
PresentParams.Flags = Config->Direct3D.Flags;
PresentParams.FullScreen_RefreshRateInHz = Config->Direct3D.Windowed ? D3DPRESENT_RATE_DEFAULT : Config->Direct3D.Videomode.RefreshRate;
PresentParams.PresentationInterval = Config->Direct3D.V_SyncEnabled ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
// Create Device
HRESULT hRes;
if (FAILED(hRes = D3D->CreateDeviceEx(Config->Direct3D.AdapterID, Config->Direct3D.DeviceType,
Window, Config->Direct3D.Flags, &PresentParams, NULL, &D3DDevice)))
{
ex_ERROR_DIRECTX("Error when creating D3DDevice!", hRes);
return ex_ERROR;
}
PDIRECT3DDEVICE9EX D3DDevice;
D3DPRESENT_PARAMETERS PresentParams;
this magic
Config is just a struct that contains the parameters for the presentation-struct. when i debugged the parameters were the following:
PresentParams.BackBufferWidth = 1366;
PresentParams.BackBufferHeight = 768;
PresentParams.BackBufferFormat = D3DFMT_R5G6B5;;
PresentParams.BackBufferCount = 1;
PresentParams.MultiSampleType = D3DMULTISAMPLE_8_SAMPLES;
PresentParams.MultiSampleQuality = 0;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow = Window;
PresentParams.Windowed = TRUE;
PresentParams.EnableAutoDepthStencil = TRUE;
PresentParams.AutoDepthStencilFormat = D3DFMT_D24S8;
PresentParams.Flags = D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE;
PresentParams.FullScreen_RefreshRateInHz = 0;
PresentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
the devicetype was D3DDEVTYPE_HAL.
my machine should support all these parameters. i took a look on the caps viewer to check the videomodes:
the last entry shows that my settings are so far accepted. of course the rest (linke z-stencilbuffer format) aren't considered here, but i assure you that the rest is compatible.
now to the drawing of y triangle:
the vertexstruct:
// +++++++++++++++++++++++++++
// Vertexstruct
struct TestVertex
{
exVector3 Position;
exColor Color;
static const DWORD FVF;
};
const DWORD TestVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;
TestVertex Vertices[3];
the init:
// Set FVF
if (FAILED(hRes = D3DDevice->SetFVF(TestVertex::FVF)))
{
ex_ERROR_DIRECTX("Error when setting FVF", hRes);
return ex_ERROR;
}
the drawing;
D3DDevice->BeginScene();
// Draw triangle
if (FAILED(hRes = D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, Vertices, sizeof(TestVertex))))
{
ex_ERROR_DIRECTX("Error when drawing the triangle!", hRes);
return ex_STOP;
}
D3DDevice->EndScene();
hope i havn't forgotten anything...