PLUGIN_EXPORT void WINAPI OnFilledBackBuffer(filledBackBuffer *p, DWORD paramSize) {
std::cout << "Locking now" << std::endl;
D3DLOCKED_RECT *pLRect;
if (SUCCEEDED(p->depthBbuffer->LockRect(pLRect, NULL, D3DLOCK_READONLY)))
{
std::cout << "Lock successful" << std::endl;
p->depthBuffer->UnlockRect();
std::cout << "Unlocked" << std::endl;
}
else
{
std::cout << "Failed lock attempt" << std::endl;
}
}
Hello everyone.
I work for a company that is using an old computer game for visualisations. The computer game has an open plugin architecture, but we don't have access to the source code, or ability to input our own shaders etc.
Essentially what we want to do is query the depth buffer to get an approximate (we can deduce to a degree) value of the depth per pixel on screen. We want to do this in order to simulate a ladar/lidar scan of an image - much like a drone could potentially do.
Through one of the engine callbacks we are given a struct containing two IDirect3DSurface9 pointers, one for the depth buffer and one for the render target. This callback is called once the back buffer has been filled, and is aptly named 'OnFilledBackBuffer'.
I am currently attempting to lock the depth buffer via the code above, however this always failed to lock, and then causes a CTD.
I suspect this is because the depthBuffer is not lockable... How else should I be doing this?
Thanks
Guy