Original Post
Hello,
I made a function for my DirectX 6 engine that takes a picture of the screen and saves it to a bitmap file. I tested it on a simple unsigned char* buffer that I created and it worked. I want to copy the primary buffer to the bitmap buffer, but it always crashes when I do that. I know it''s not the function itself, because as I said it works for a unsigned char* buffer. I have 3 questions:
1.) Are there any tutorials or examples on the internet on how to create screenshots with DirectDraw?
2.) Which buffer should I copy to the bitmap? I would assume that it would be the primary buffer, because the back buffer is half written by the time the mainloop reads the screenshot key.
3.) Is this code correct:
unsigned char *buffer = (unsigned char *)PrimarySurface();
inline LPDIRECTDRAWSURFACE4 PrimarySurface() { return m_lpddsprimary; }
And do I have to lock the primary surface before copying from it?
Thanks for your time,
Jon
