Details
-
Suggestion
-
Resolution: Moved
-
P2: Important
-
4.3.0
-
None
Description
QGlWidget::renderText() can be slow. When looking at the actual renderText() code it is obvious that the reason
for being slow when drawing a lot of text to the screen is because every time it is called all the OpenGL states have to be set to render the text. This is very inefficient from a OpenGL standpoint to be constantly changing/querying the OpenGL states.
glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]);
glGetDoublev(GL_PROJECTION_MATRIX, &proj[0][0]);
glGetIntegerv(GL_VIEWPORT, &view[0]);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, width(), height());
glOrtho(0, width(), height(), 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glAlphaFunc(GL_GREATER, 0.0);
glEnable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST);
It would be useful if some methods were added that would allow setting up a Text rendering mode in the OGLWidget context.
It would work something like this:
OGLWidget::EnableTextMode();
// issue all the desired text to be drawn between the two methods
for (;when done rendering text;
{
OGLWidget::renderTextMode(...);
}
OGLWidget::DisableTextMode();