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);