我的窗户里有一个纹理盒子。在这个框的顶部使用QuickFont进行文本打印。由于有很多文本被添加,而不是一次全部添加,因此需要花费时间来刷新该屏幕。为了节省时间和资源,我想用文本对文本框进行screencap,并将其用作纹理,因为在第一次渲染后没有任何东西需要解析。保存OpenTK屏幕的位图,但QuickFont文本不显示?
我可以让glControl屏蔽上盖本身并将其保存到位图中,但屏幕上没有文字。 (F.Y.I这应该是药房标签打印输出的所见即所得渲染)
有没有办法让文本保存呢?
if (GraphicsContext.CurrentContext == null)
throw new GraphicsContextException();
Bitmap bmp = new Bitmap(frm1.ClientSize.Width, frm1.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(frm1.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, frm1.ClientSize.Width,frm1.ClientSize.Height,
OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte, data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
bmp.Save("Move.bmp", ImageFormat.Bmp);
bmp.Dispose();