我的窗戶裏有一個紋理盒子。在這個框的頂部使用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();