-
Capture the screen
Hello!
Im using a function to capture the screen. It works great on windows and Firefox, etc. But in Counter-Strike, the program still takes as it wasn't in Counter-Strike. I don't understand why. Im using this code: http://www.codeguru.com/csharp/cshar...icle.php/c6139
-
I am not even going to look at the code. You can't copy a desktop HDC the same way as you would copy a DX or OGL screen buffer. They are two different types of device contexts.
-
So what i need is a Open GL screen buffer? I've just started with C# so im trying to learn.
-
Are there any good tutorials on how to do this? I've searched alot, and i mean ALOT. I've only found others who asks the same question, not the answer. Please help me! :)
EDIT:
Okay, I think i've gotten more close. Although, my pics is black, ingame and outgame. Here's my code;
Code:
int pWidth = Screen.GetBounds(new Point(0, 0)).Width;
int pHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap b = new Bitmap(pWidth, pHeight, PixelFormat.Format32bppArgb);
BitmapData bd = b.LockBits(new Rectangle(0, 0, pWidth, pHeight),
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Gl.glReadPixels(0, 0, pWidth, pHeight, Gl.GL_BGRA_EXT, Gl.GL_UNSIGNED_BYTE, bd.Scan0);
b.UnlockBits(bd);
b.Save("data/" + textBox1.Text + "/" + DateTime.Now.Minute + DateTime.Now.Second + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);