Add:
SurfaceDesc.dwSize = sizeof(DDSURFACEDESC2);
Before the call to CreateSurface.
Aldenar
SurfaceDesc.dwSize = sizeof(DDSURFACEDESC2);
Before the call to CreateSurface.
Aldenar
HRESULT hr;
LPDIRECTDRAWSURFACE7 ZBuffer;
DDSURFACEDESC2 SurfaceDesc;
ZeroMemory(&SurfaceDesc, sizeof(SurfaceDesc));
SurfaceDesc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
SurfaceDesc.dwWidth = m_dwWidth;
SurfaceDesc.dwHeight = m_dwHeight;
SurfaceDesc.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
SurfaceDesc.ddpfPixelFormat.dwZBufferBitDepth = 24;
SurfaceDesc.ddpfPixelFormat.dwZBitMask = 0xFFFFFF;
hr = m_pDD->CreateSurface(&SurfaceDesc, &ZBuffer, NULL);
if (hr != DD_OK)
{
m_ErrorSys.Log("G3D::InitZBuffer, CreateSurface() Failed", hr, true, true);
return false;
}
if( FAILED( hr = m_pBack->AddAttachedSurface( ZBuffer ) ) )
{
m_ErrorSys.Log("G3D::InitZBuffer, Could not attach ZBuffer to back buffer", hr, true, true);
return false;
}
return true;
I have tried several different ZBuffer depths (16, 24, 32) and that doesn't seem to help, same with trying to use video memory or system memory. I'm using a Viper 550 TNT card which I thought could handle ZBuffers? Any ideas as to what is causing the invalid parameter?