Need to print labels on a GlControl box for a graph. This can be done easily with Glut. However, OpenGL.Net does not seem to support GLUT.
What I have tried:
Tried writing the string on a bitmap and then print it on the Glcontrol but it prints some garbage value.
The application is in WinForm.
The following code was writen in the GlControl.render event's delegate function:
Gl.Clear(ClearBufferMask.ColorBufferBit);
Gl.ClearColor(1f,1f,1f,0);
Gl.MatrixMode(MatrixMode.Texture);
Gl.LoadIdentity();
Font drFont = new Font("Arial", 10);
Pen redPen = new Pen(Color.Red, 1);
SolidBrush drBrush = new SolidBrush(Color.Red);
Bitmap bmp = new Bitmap(100,100,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
RectangleF rectf = new RectangleF(0, 0, bmp.Width, bmp.Height);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
StringFormat format = new StringFormat()
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
g.DrawString("Abc", new Font("Tahoma", 80), Brushes.Black, rectf, format);
g.Flush();
ImageConverter i = new ImageConverter();
byte[] b = (byte[])i.ConvertTo(bmp, typeof(byte[]));
Gl.RasterPos3(0, 0, 0);
Gl.Bitmap(100, 100, 0, 0, 0, 0, b);
Thanks in Advance