Original Post
I am trying to port an application from DX3 to DX7 and can''t seem to be able to create the z-buffers as I used to. I found out that the creation procedure had changed and that the dwZBufferBitDepth was no longer directly under DDSURFACEDESC. Ok, so I changed my code and now use DDSURFACEDESC2 and DDSD_PIXELFORMAT instead. The problem is that my creation now fails. What have I done wrong?
The z-buffer is used as a stand alone surface that I later use to copy to the screen-attached z-buffer.
Here is the code I use now that does not work:
DDSURFACEDESC2 ddsd;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS / DDSD_HEIGHT / DDSD_WIDTH / DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
ddsd.dwHeight = 128;
ddsd.dwWidth = 128;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
ddsd.ddpfPixelFormat.dwZBufferBitDepth = 16;
d3dapp->m_pDD->CreateSurface(&ddsd, &m_lpDDSz, NULL);