Original Post
I've run into a little snag in my program. When I create a surface in memory, and put the image I want into that surface, and export that surface to a file, the surface works fine. The problem is, when I try to copy the surface onto the backbuffer, and flip the backbuffer to the screen, nothing is rendered. Can someone help me here? I'm almost positive I just made a simple mistake.
// This is the surface I want to draw onto the backbuffer
LPDIRECT3DSURFACE9 TheSurface;
// We use Direct3D to create the surface in memory...
D3D_Device->CreateOffscreenPlainSurface(g_Width, g_Height, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &TheSurface, NULL);
// We make a locked rect so we can lock the surface and write to it
D3DLOCKED_RECT TheLockedRect;
// We lock the surface
TheSurface->LockRect(&TheLockedRect, NULL, NULL);
// We write to the surface using the data generated in the previous (not shown here) function
memcpy(TheLockedRect.pBits, PixelGrid, g_Width * g_Height * sizeof(Pixel));
// We unlock the surface
TheSurface->UnlockRect();
// We save the surface to a file - Note: I know that everything up to this point was successful, because the file output looks correct
D3DXSaveSurfaceToFile("Surface.bmp", D3DXIFF_BMP, TheSurface, NULL, NULL);
// Now we're going to draw the surface onto the backbuffer
D3D_Device->BeginScene();
D3D_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
// We have the backbuffer surface...
LPDIRECT3DSURFACE9 Backbuffer;
// We get the back buffer surface
D3D_Device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &Backbuffer);
// We update the back buffer data with the data from the other surface
D3D_Device->UpdateSurface(TheSurface, NULL, Backbuffer, NULL);
// We flip the back buffer onto the screen
D3D_Device->Present(NULL, NULL, NULL, NULL);
// Scene is over - I SHOULD see the flipped backbuffer, but I don't
D3D_Device->EndScene();