Print OpenGLControl from C#
Submitted by e_pech on February 28, 2008 - 4:23pm.
Hey! I'd like to print the drawing I have on an OpenGL Control using C#, is there any function or does any one have any code that might help?? I'd really appreciate it!!

Use Gl.glReadPixels to read
Use Gl.glReadPixels to read the contents of the screen into a byte array, create a System.Drawing.Bitmap and print that.
------
OpenTK
Thank you very much
Thank you very much StApostol! I'll try to figure it out with that Procedure!! Thank you!
#region public
#region public Bitmap GrabScreenshot()
/// Grabs a screenshot of the frontbuffer contents.
/// A System.Drawing.Bitmap, containing the contents of the frontbuffer.
public Bitmap GrabScreenshot()
{
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Gl.glReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, Gl.GL_BGR, PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp;
}
#endregion
Source