System.Drawing.Bitmap mTextBitmap = new Bitmap(TextWidth, TextHeight);
using (Graphics g = Graphics.FromImage(mTextBitmap))
{
g.Clear(Transparency);
SolidBrush TextClr = new SolidBrush(TextColor);
SizeF extent = new SizeF(0, 0);
mTextBitmap.MakeTransparent(Transparency);
Font aFont = AppropriateFont(g, 0.0f, 50.0f, mTextBitmap.Size, Text, new Font(FontName, 50.0f), out extent);
g.DrawString(Text, aFont, TextClr, new PointF(0.0f, 0.0f));
}
byte[] parts = convertBitmapToBytes(mTextBitmap);
gr.glMatrixMode(GR.GL_PROJECTION);
gr.glPushMatrix();
gr.glLoadIdentity();
gr.glOrtho
(
(double)0,
clientWidth - 1.0,
(double)0,
clientHeight - 1,
-1.0,
1.0
);
gr.glMatrixMode(GR.GL_MODELVIEW);
gr.glLoadIdentity();
gr.glRasterPos2d(location[0], location[1]);//glWindowPos2dv(location);
gr.glPixelStorei(GR.GL_UNPACK_ALIGNMENT, 1);
gr.glPushAttrib(GR.GL_LIST_BIT);
gr.glBitmap(mTextBitmap.Width, mTextBitmap.Height, 0, 0, Convert.ToSingle(mTextBitmap.Width), 0, parts);
gr.glPopAttrib();
gr.glPopMatrix();
gr.glMatrixMode(GR.GL_PROJECTION);
gr.glPopMatrix();