Need to speed this up

I’m rendering Text using Textures but its super slow any advice as to how to speed it up. Is there any other way to use Textures without the Quads or is there a way to speed up the Quads?

// Change rendering conditions
gr.glDisable(GR.GL_DEPTH_TEST);
gr.glDisable(GR.GL_CULL_FACE);

  // Preserve current matrices, and switch to an orthographic view, and 
  //   do scaling and translation as necessary.
  
  gr.glMatrixMode(GR.GL_PROJECTION);
  gr.glPushMatrix();
  gr.glLoadIdentity();
  gr.glOrtho
  (
      (double)0,
      (double)(clientWidth - 1),
      (double)0,
      (double)(clientHeight - 1),
      -1.0,
      1.0
  );
  gr.glMatrixMode(GR.GL_MODELVIEW);
  gr.glLoadIdentity();
  if (null != texture)
  {
    // Enable texture
    texture.SetAsActiveTexture(gr);
    gr.glEnable(GR.GL_TEXTURE_2D);
  }
  // Enable blending
  gr.glEnable(GR.GL_BLEND);
  gr.glBlendFunc(GR.GL_SRC_ALPHA, GR.GL_ONE_MINUS_SRC_ALPHA);
  // Draw a quad
  gr.glBegin(GR.GL_QUADS);
  // TOP-LEFT
  gr.glTexCoord2f(0.0f, 1.0f);
  gr.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  gr.glVertex3f((float)(drawX), (float)((clientHeight - 1) - drawYTextMode), 0.0f);
  // BOTTOM-LEFT
  gr.glTexCoord2f(0.0f, 0.0f);
  gr.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  gr.glVertex3f((float)(drawX), (float)((clientHeight - 1) - (drawYTextMode + drawHeight)), 0.0f);
  // BOTTOM-RIGHT
  gr.glTexCoord2f(1.0f, 0.0f);
  gr.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  gr.glVertex3f((float)(drawX + (drawWidth)), (float)((clientHeight - 1) - (drawYTextMode + drawHeight)), 0.0f);
  // TOP-RIGHT
  gr.glTexCoord2f(1.0f, 1.0f);
  gr.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  gr.glVertex3f((float)(drawX + (drawWidth)), (float)((clientHeight - 1) - drawYTextMode), 0.0f);
  gr.glEnd();
  // Disable blending
  gr.glDisable(GR.GL_BLEND);
  if (null != texture)
  {
    // Disable texture
    gr.glDisable(GR.GL_TEXTURE_2D);
    gr.glBindTexture(GR.GL_TEXTURE_2D, 0);
  }
  // Restore original matrices.
  gr.glMatrixMode(GR.GL_MODELVIEW);
  gr.glPopMatrix();
  gr.glMatrixMode(GR.GL_PROJECTION);
  gr.glPopMatrix();
  // Restore rendering conditions
  
  gr.glEnable(GR.GL_DEPTH_TEST);
  gr.glEnable(GR.GL_CULL_FACE);

Do you call all of that code just to draw each single character?

No it draws the entire text onto a bitmap.

Here’s the code that creates the bitmap where the entire string is drawn:

mTextBitmap = new Bitmap(Convert.ToInt32(myTextScale.FontWidth * Text.Length), Convert.ToInt32(myTextScale.FontHeight));
using (Graphics g = Graphics.FromImage(mTextBitmap))
{
g.Clear(Color.FromArgb(0,myStack.BackColor[0],myStack.BackColor[1],myStack.BackColor[2]));
SolidBrush TextClr = new SolidBrush(Color.FromArgb(255, myStack.TextColor[0], myStack.TextColor[1], myStack.TextColor[2]));

            SizeF extent = new SizeF(0, 0);
           
            Font aFont = AtlasSupport.AppropriateFont(g, 0.0f, 50.0f, mTextBitmap.Size, Text, new Font(myStack.FontName, 50.0f), out extent);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
            g.DrawString(Text, aFont, TextClr, new PointF(0.0f, 0.0f));
        }
        
        mTextTexture.UpdateTextureWithBitmapData(gr, mTextBitmap);

The way you do your text drawing is by having the GDI (or whatever) draw to a bitmap, then you read it and upload it to OpenGL, where you then draw it to the screen.

First thing is that you should only be regenerating your texture if the text has changed.

But most importantly second, you can’t really expect that to be particularly fast. The general way this is handled is that you create a texture containing letters (once), and you draw each letter of the string of interest.